cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r571502 - /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
Date Fri, 31 Aug 2007 16:01:06 GMT
Author: dkulp
Date: Fri Aug 31 09:01:05 2007
New Revision: 571502

URL: http://svn.apache.org/viewvc?rev=571502&view=rev
Log:
Add method to invoker to allow subclasses to know when it's done with the service object

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?rev=571502&r1=571501&r2=571502&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
Fri Aug 31 09:01:05 2007
@@ -44,22 +44,26 @@
     public Object invoke(Exchange exchange, Object o) {
 
         final Object serviceObject = getServiceObject(exchange);
+        try {
 
-        BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
-        MethodDispatcher md = (MethodDispatcher) 
-            exchange.get(Service.class).get(MethodDispatcher.class.getName());
-        Method m = md.getMethod(bop);
-        //Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
-        m = matchMethod(m, serviceObject);
-        
-        List<Object> params = null;
-        if (o instanceof List) {
-            params = CastUtils.cast((List<?>)o);
-        } else if (o != null) {
-            params = new MessageContentsList(o);
+            BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+            MethodDispatcher md = (MethodDispatcher) 
+                exchange.get(Service.class).get(MethodDispatcher.class.getName());
+            Method m = md.getMethod(bop);
+            //Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
+            m = matchMethod(m, serviceObject);
+            
+            List<Object> params = null;
+            if (o instanceof List) {
+                params = CastUtils.cast((List<?>)o);
+            } else if (o != null) {
+                params = new MessageContentsList(o);
+            }
+            
+            return invoke(exchange, serviceObject, m, params);
+        } finally {
+            releaseServiceObject(exchange, serviceObject);
         }
-        
-        return invoke(exchange, serviceObject, m, params);
     }
 
     protected Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object>
params) {
@@ -123,6 +127,15 @@
      * Creates and returns a service object depending on the scope.
      */
     public abstract Object getServiceObject(final Exchange context);
+
+    /**
+     * Called when the invoker is done with the object.   Default implementation
+     * does nothing.
+     * @param context
+     * @param obj
+     */
+    public void releaseServiceObject(final Exchange context, Object obj) {
+    }
 
     /**
      * Returns a Method that has the same declaring class as the class of



Mime
View raw message