You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/18 09:39:45 UTC

svn commit: r1818542 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group: GroupModel.java GroupServiceModel.java ServiceGroupReader.java

Author: mbrohl
Date: Mon Dec 18 09:39:45 2017
New Revision: 1818542

URL: http://svn.apache.org/viewvc?rev=1818542&view=rev
Log:
Improved: General refactoring and code improvements, package 
org.apache.ofbiz.service.group.
(OFBIZ-9932)

Thanks Dennis Balkir for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java?rev=1818542&r1=1818541&r2=1818542&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupModel.java Mon Dec 18 09:39:45 2017
@@ -50,7 +50,7 @@ public class GroupModel {
     public GroupModel(Element group) {
         this.sendMode = group.getAttribute("send-mode");
         this.groupName = group.getAttribute("name");
-        this.services = new LinkedList<GroupServiceModel>();
+        this.services = new LinkedList<>();
         this.lastServiceRan = -1;
 
         if (groupName.isEmpty()) {
@@ -136,7 +136,7 @@ public class GroupModel {
         } else if ("first-available".equals(this.getSendMode())) {
             return runOne(dispatcher, localName, context);
         } else if ("none".equals(this.getSendMode())) {
-            return new HashMap<String, Object>();
+            return new HashMap<>();
         } else {
             throw new GenericServiceException("This mode is not currently supported");
         }
@@ -159,7 +159,7 @@ public class GroupModel {
     private Map<String, Object> runAll(ServiceDispatcher dispatcher, String localName, Map<String, Object> context)
             throws GenericServiceException {
         Map<String, Object> runContext = UtilMisc.makeMapWritable(context);
-        Map<String, Object> result = new HashMap<String, Object>();
+        Map<String, Object> result = new HashMap<>();
         for (GroupServiceModel model : services) {
             if (Debug.verboseOn()) {
                  Debug.logVerbose("Using Context: " + runContext, module);

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java?rev=1818542&r1=1818541&r2=1818542&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/GroupServiceModel.java Mon Dec 18 09:39:45 2017
@@ -112,13 +112,11 @@ public class GroupServiceModel {
             if (requiredOut.size() > 0) {
                 Debug.logWarning("Grouped service (" + getName() + ") requested 'async' invocation; running sync because of required OUT parameters.", module);
                 return dispatcher.runSync(localName, model, thisContext);
-            } else {
-                dispatcher.runAsync(localName, model, thisContext, false);
-                return new HashMap<String, Object>();
             }
-        } else {
-            return dispatcher.runSync(localName, model, thisContext);
+            dispatcher.runAsync(localName, model, thisContext, false);
+            return new HashMap<>();
         }
+        return dispatcher.runSync(localName, model, thisContext);
     }
 
     /**

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java?rev=1818542&r1=1818541&r2=1818542&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/group/ServiceGroupReader.java Mon Dec 18 09:39:45 2017
@@ -40,7 +40,7 @@ public class ServiceGroupReader {
     public static final String module = ServiceGroupReader.class.getName();
 
     // using a cache is dangerous here because if someone clears it the groups won't work at all: public static UtilCache groupsCache = new UtilCache("service.ServiceGroups", 0, 0, false);
-    private static final Map<String, GroupModel> groupsCache = new ConcurrentHashMap<String, GroupModel>();
+    private static final Map<String, GroupModel> groupsCache = new ConcurrentHashMap<>();
 
     public static void readConfig() {
         List<ServiceGroups> serviceGroupsList = null;