servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r533111 - /incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
Date Fri, 27 Apr 2007 14:17:30 GMT
Author: gnodet
Date: Fri Apr 27 07:17:29 2007
New Revision: 533111

URL: http://svn.apache.org/viewvc?view=rev&rev=533111
Log:
SM-941: NPE in BeanComponent - checkEndOfRequest

Modified:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java?view=diff&rev=533111&r1=533110&r2=533111
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
Fri Apr 27 07:17:29 2007
@@ -217,45 +217,47 @@
             requests.put(corId, req);
         }
         currentRequest.set(req);
-        // If the bean implements MessageExchangeListener,
-        // just call the method
-        if (req.getBean() instanceof MessageExchangeListener) {
-            ((MessageExchangeListener) req.getBean()).onMessageExchange(exchange);
-        } else {
-            // Exchange is finished
-            if (exchange.getStatus() == ExchangeStatus.DONE) {
-                return;
-            // Exchange has been aborted with an exception
-            } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
-                return;
-            // Fault message
-            } else if (exchange.getFault() != null) {
-                // TODO: find a way to send it back to the bean before setting the DONE status
-                done(exchange);
+        synchronized (req) {
+            // If the bean implements MessageExchangeListener,
+            // just call the method
+            if (req.getBean() instanceof MessageExchangeListener) {
+                ((MessageExchangeListener) req.getBean()).onMessageExchange(exchange);
             } else {
-                MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
-                        req.getBean(), getBeanInfo(), exchange, this);
-                if (invocation == null) {
-                    throw new UnknownMessageExchangeTypeException(exchange, this);
-                }
-                try {
-                    invocation.proceed();
-                } catch (Exception e) {
-                    throw e;
-                } catch (Throwable throwable) {
-                    throw new MethodInvocationFailedException(req.getBean(), invocation,
exchange, this, throwable);
-                }
-                if (exchange.getStatus() == ExchangeStatus.ERROR) {
-                    send(exchange);
-                }
-                if (exchange.getFault() == null && exchange.getMessage("out") ==
null)  {
-                    // TODO: handle MEP correctly (DONE should only be sent for InOnly)
+                // Exchange is finished
+                if (exchange.getStatus() == ExchangeStatus.DONE) {
+                    return;
+                // Exchange has been aborted with an exception
+                } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+                    return;
+                // Fault message
+                } else if (exchange.getFault() != null) {
+                    // TODO: find a way to send it back to the bean before setting the DONE
status
                     done(exchange);
+                } else {
+                    MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
+                            req.getBean(), getBeanInfo(), exchange, this);
+                    if (invocation == null) {
+                        throw new UnknownMessageExchangeTypeException(exchange, this);
+                    }
+                    try {
+                        invocation.proceed();
+                    } catch (Exception e) {
+                        throw e;
+                    } catch (Throwable throwable) {
+                        throw new MethodInvocationFailedException(req.getBean(), invocation,
exchange, this, throwable);
+                    }
+                    if (exchange.getStatus() == ExchangeStatus.ERROR) {
+                        send(exchange);
+                    }
+                    if (exchange.getFault() == null && exchange.getMessage("out")
== null)  {
+                        // TODO: handle MEP correctly (DONE should only be sent for InOnly)
+                        done(exchange);
+                    }
                 }
             }
+            checkEndOfRequest(req);
+            currentRequest.set(null);
         }
-        checkEndOfRequest(req);
-        currentRequest.set(null);
     }
     
     protected void onConsumerExchange(MessageExchange exchange) throws Exception {



Mime
View raw message