svn commit: r903803 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: GenericInvoker.java ModelServiceReader.java 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: r903803 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: GenericInvoker.java ModelServiceReader.java ServiceDispatcher.java

doogie-3
Author: doogie
Date: Wed Jan 27 19:53:14 2010
New Revision: 903803

URL: http://svn.apache.org/viewvc?rev=903803&view=rev
Log:
Remove several methods from the runtime-compiled wrapper class; this
removes use of 2.1M of permgem memory.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java?rev=903803&r1=903802&r2=903803&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java Wed Jan 27 19:53:14 2010
@@ -64,17 +64,6 @@
         throws GenericServiceException;
 
     /**
-     * Run the service asynchronously and IGNORE the result.
-     *
-     * @param localName Name of the LocalDispatcher.
-     * @param engine GenericEngine object.
-     * @param context Map of name, value pairs composing the context.
-     * @param persist True for store/run; False for run.
-     * @throws GenericServiceException
-     */
-    public void runAsync(String localName, GenericEngine engine, Map<String, Object> context, boolean persist) throws GenericServiceException;
-
-    /**
      * Send the service callbacks
      * @param engine GenericEngine object
      * @param context Map of name, value pairs composing the context
@@ -82,9 +71,7 @@
      * @param mode Service mode (sync or async)
      * @throws GenericServiceException
      */
-    public void sendCallbacks(GenericEngine engine, Map<String, Object> context, int mode) throws GenericServiceException;
-    public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, int mode) throws GenericServiceException;
-    public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Throwable t, int mode) throws GenericServiceException;
+    public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, Throwable t, int mode) throws GenericServiceException;
     public GenericInvoker copy(ModelService modelService);
 }
 

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=903803&r1=903802&r2=903803&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Wed Jan 27 19:53:14 2010
@@ -265,7 +265,11 @@
         service.name = UtilXml.checkEmpty(serviceElement.getAttribute("name")).intern();
         Wrap<GenericInvoker> wrap = new Wrap<GenericInvoker>().fileName(resourceLocation + '#' + service.name).wrappedClass(GenericInvokerImpl.class);
         for (Method method: GenericInvokerImpl.class.getDeclaredMethods()) {
-            wrap.wrap(method);
+            if (method.getName().startsWith("run")) {
+                wrap.wrap(method);
+            } else if (method.getName().startsWith("send")) {
+                wrap.wrap(method);
+            }
         }
         Object startLine = serviceElement.getUserData("startLine");
         if (startLine != null) {
@@ -806,23 +810,21 @@
         }
 
         public void runAsync(String localName, GenericEngine engine, Map<String, Object> context, GenericRequester requester, boolean persist) throws GenericServiceException {
-            engine.runAsync(localName, modelService, context, requester, persist);
-        }
-
-        public void runAsync(String localName, GenericEngine engine, Map<String, Object> context, boolean persist) throws GenericServiceException {
-            engine.runAsync(localName, modelService, context, persist);
-        }
-
-        public void sendCallbacks(GenericEngine engine, Map<String, Object> context, int mode) throws GenericServiceException {
-            engine.sendCallbacks(modelService, context, mode);
-        }
-
-        public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, int mode) throws GenericServiceException {
-            engine.sendCallbacks(modelService, context, result, mode);
+            if (requester != null) {
+                engine.runAsync(localName, modelService, context, requester, persist);
+            } else {
+                engine.runAsync(localName, modelService, context, persist);
+            }
         }
 
-        public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Throwable t, int mode) throws GenericServiceException {
-            engine.sendCallbacks(modelService, context, t, mode);
+        public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, Throwable t, int mode) throws GenericServiceException {
+            if (t != null) {
+                engine.sendCallbacks(modelService, context, t, mode);
+            } else if (result != null) {
+                engine.sendCallbacks(modelService, context, result, mode);
+            } else {
+                engine.sendCallbacks(modelService, context, mode);
+            }
         }
 
         public GenericInvokerImpl copy(ModelService modelService) {

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=903803&r1=903802&r2=903803&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Wed Jan 27 19:53:14 2010
@@ -392,7 +392,7 @@
                     // ===== invoke the service =====
                     if (!isError && !isFailure) {
                         Map<String, Object> invokeResult = modelService.invoker.runSync(localName, engine, context);
-                        modelService.invoker.sendCallbacks(engine, context, invokeResult, GenericEngine.SYNC_MODE);
+                        modelService.invoker.sendCallbacks(engine, context, invokeResult, null, GenericEngine.SYNC_MODE);
                         if (invokeResult != null) {
                             result.putAll(invokeResult);
                         } else {
@@ -508,7 +508,7 @@
                 }
                 String errMsg = "Service [" + modelService.name + "] threw an unexpected exception/error";
                 Debug.logError(t, errMsg, module);
-                modelService.invoker.sendCallbacks(engine, context, t, GenericEngine.SYNC_MODE);
+                modelService.invoker.sendCallbacks(engine, context, null, t, GenericEngine.SYNC_MODE);
                 try {
                     TransactionUtil.rollback(beganTrans, errMsg, t);
                 } catch (GenericTransactionException te) {
@@ -694,12 +694,8 @@
 
                 // run the service
                 if (!isError && !isFailure) {
-                    if (requester != null) {
-                        service.invoker.runAsync(localName, engine, context, requester, persist);
-                    } else {
-                        service.invoker.runAsync(localName, engine, context, persist);
-                    }
-                    service.invoker.sendCallbacks(engine, context, GenericEngine.ASYNC_MODE);
+                    service.invoker.runAsync(localName, engine, context, requester, persist);
+                    service.invoker.sendCallbacks(engine, context, null, null, GenericEngine.ASYNC_MODE);
                 }
 
                 if (Debug.timingOn()) {
@@ -712,7 +708,7 @@
                 }
                 String errMsg = "Service [" + service.name + "] threw an unexpected exception/error";
                 Debug.logError(t, errMsg, module);
-                service.invoker.sendCallbacks(engine, context, t, GenericEngine.ASYNC_MODE);
+                service.invoker.sendCallbacks(engine, context, null, t, GenericEngine.ASYNC_MODE);
                 try {
                     TransactionUtil.rollback(beganTrans, errMsg, t);
                 } catch (GenericTransactionException te) {