You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2009/03/09 17:54:56 UTC

svn commit: r751745 - in /servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl: ComponentContextImpl.java EndpointImpl.java

Author: gnodet
Date: Mon Mar  9 16:54:56 2009
New Revision: 751745

URL: http://svn.apache.org/viewvc?rev=751745&view=rev
Log:
Make sure exchanges won't be lost of the endpoint queue is full

Modified:
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java?rev=751745&r1=751744&r2=751745&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java Mon Mar  9 16:54:56 2009
@@ -52,7 +52,7 @@
  */
 public class ComponentContextImpl extends AbstractComponentContext {
 
-    public static final int DEFAULT_QUEUE_CAPACITY = 100;
+    public static final int DEFAULT_QUEUE_CAPACITY = 1024;
 
     private static final Log LOG = LogFactory.getLog(ComponentContextImpl.class);
 

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java?rev=751745&r1=751744&r2=751745&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/EndpointImpl.java Mon Mar  9 16:54:56 2009
@@ -16,22 +16,23 @@
  */
 package org.apache.servicemix.jbi.runtime.impl;
 
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+
 import org.apache.servicemix.nmr.api.Channel;
 import org.apache.servicemix.nmr.api.Endpoint;
 import org.apache.servicemix.nmr.api.Exchange;
-import org.w3c.dom.DocumentFragment;
-
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.xml.namespace.QName;
-import java.util.Queue;
-import java.util.Map;
+import org.apache.servicemix.nmr.api.ServiceMixException;
 
 /**
  */
 public class EndpointImpl extends ServiceEndpointImpl implements Endpoint {
 
     private Channel channel;
-    private Queue<Exchange> queue;
+    private BlockingQueue<Exchange> queue;
 
     public EndpointImpl(Map<String, ?> properties) {
         super(properties);
@@ -41,7 +42,11 @@
         if (exchange.getProperty(ServiceEndpoint.class) == null) {
             exchange.setProperty(ServiceEndpoint.class, this);
         }
-        queue.offer(exchange);
+        try {
+            queue.offer(exchange, Long.MAX_VALUE, TimeUnit.NANOSECONDS);
+        } catch (InterruptedException e) {
+            throw new ServiceMixException(e);
+        }
     }
 
     public Channel getChannel() {
@@ -52,11 +57,11 @@
         this.channel = channel;
     }
 
-    public Queue<Exchange> getQueue() {
+    public BlockingQueue<Exchange> getQueue() {
         return queue;
     }
 
-    public void setQueue(Queue<Exchange> queue) {
+    public void setQueue(BlockingQueue<Exchange> queue) {
         this.queue = queue;
     }