Skip to content
Permalink
Browse files

Improved: ‘ServiceDispatcher’ is not meant to be extended

(OFBIZ-11032)

This makes the ‘ServiceDispatcher’ class final and replaces the
‘protected’ modifier with ‘private’ for all the fields and methods in
this class.

Thanks Girish Vasmatkar, Jacques Le Roux and Suraj Khurana for the
review.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859938 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed May 25, 2019
1 parent 410a67a commit 79edce69f82922b1ea3cc12549b44ad63c5c6472
Showing with 12 additions and 12 deletions.
  1. +12 −12 framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java
@@ -64,29 +64,29 @@
* The global service dispatcher. This is the "engine" part of the
* Service Engine.
*/
public class ServiceDispatcher {
public final class ServiceDispatcher {

public static final String module = ServiceDispatcher.class.getName();
public static final int lruLogSize = 200;
public static final int LOCK_RETRIES = 3;

protected static final Map<RunningService, ServiceDispatcher> runLog = new ConcurrentLinkedHashMap.Builder<RunningService, ServiceDispatcher>().maximumWeightedCapacity(lruLogSize).build();
private static final Map<RunningService, ServiceDispatcher> runLog = new ConcurrentLinkedHashMap.Builder<RunningService, ServiceDispatcher>().maximumWeightedCapacity(lruLogSize).build();
private static ConcurrentHashMap<String, ServiceDispatcher> dispatchers = new ConcurrentHashMap<>();
// FIXME: These fields are not thread-safe. They are modified by EntityDataLoadContainer.
// We need a better design - like have this class query EntityDataLoadContainer if data is being loaded.
private static boolean enableJM = true;
private static boolean enableJMS = UtilProperties.getPropertyAsBoolean("service", "enableJMS", true);
private static boolean enableSvcs = true;

protected Delegator delegator = null;
protected GenericEngineFactory factory = null;
protected Security security = null;
protected Map<String, DispatchContext> localContext = new HashMap<>();
protected Map<String, List<GenericServiceCallback>> callbacks = new HashMap<>();
protected JobManager jm = null;
protected JmsListenerFactory jlf = null;
private Delegator delegator = null;
private GenericEngineFactory factory = null;
private Security security = null;
private Map<String, DispatchContext> localContext = new HashMap<>();
private Map<String, List<GenericServiceCallback>> callbacks = new HashMap<>();
private JobManager jm = null;
private JmsListenerFactory jlf = null;

protected ServiceDispatcher(Delegator delegator, boolean enableJM, boolean enableJMS) {
private ServiceDispatcher(Delegator delegator, boolean enableJM, boolean enableJMS) {
factory = new GenericEngineFactory(this);
ServiceGroupReader.readConfig();
ServiceEcaUtil.readConfig();
@@ -132,7 +132,7 @@ protected ServiceDispatcher(Delegator delegator, boolean enableJM, boolean enabl
}
}

protected ServiceDispatcher(Delegator delegator) {
private ServiceDispatcher(Delegator delegator) {
this(delegator, enableJM, enableJMS);
}

@@ -880,7 +880,7 @@ public boolean containsContext(String name) {
return localContext.containsKey(name);
}

protected void shutdown() throws GenericServiceException {
private void shutdown() throws GenericServiceException {
Debug.logImportant("Shutting down the service engine...", module);
if (jlf != null) {
// shutdown JMS listeners

0 comments on commit 79edce6

Please sign in to comment.
You can’t perform that action at this time.