svn commit: r1859938 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1859938 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java

mthl
Author: mthl
Date: Sat May 25 10:01:14 2019
New Revision: 1859938

URL: http://svn.apache.org/viewvc?rev=1859938&view=rev
Log:
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.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java?rev=1859938&r1=1859937&r2=1859938&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java Sat May 25 10:01:14 2019
@@ -64,13 +64,13 @@ import com.googlecode.concurrentlinkedha
  * 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.
@@ -78,15 +78,15 @@ public class ServiceDispatcher {
     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 @@ public class ServiceDispatcher {
         }
     }
 
-    protected ServiceDispatcher(Delegator delegator) {
+    private ServiceDispatcher(Delegator delegator) {
         this(delegator, enableJM, enableJMS);
     }
 
@@ -880,7 +880,7 @@ public class ServiceDispatcher {
         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