camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [6/8] camel git commit: CAMEL-9150: Seda suspend/resume should not trigger start/stop logic. Requires a little api change.
Date Tue, 22 Sep 2015 08:27:57 GMT
CAMEL-9150: Seda suspend/resume should not trigger start/stop logic. Requires a little api
change.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d3c654f6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d3c654f6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d3c654f6

Branch: refs/heads/master
Commit: d3c654f6816459f76ea572e57cb9d2c05015ed3f
Parents: e75d37b
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Sep 22 10:17:33 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Sep 22 10:17:33 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/spi/ShutdownPrepared.java  | 7 +++++--
 .../apache/camel/component/disruptor/DisruptorConsumer.java   | 3 +--
 .../org/apache/camel/component/kestrel/KestrelConsumer.java   | 2 +-
 .../component/routebox/direct/RouteboxDirectConsumer.java     | 2 +-
 .../camel/component/routebox/seda/RouteboxSedaConsumer.java   | 7 +++++--
 5 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d3c654f6/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java b/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
index b6f1dd9..c65e925 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
@@ -30,15 +30,18 @@ package org.apache.camel.spi;
 public interface ShutdownPrepared {
 
     /**
-     * Prepares for shutdown.
+     * Prepares for stop/shutdown.
      * <p/>
      * The {@link ShutdownStrategy} supports preparing for shutdown using two steps.
      * First a regular preparation, where the given forced parameter will be <tt>false</tt>.
      * And if the shutdown times out, then the {@link ShutdownStrategy} performs a more aggressive
      * shutdown, calling this method a second time with <tt>true</tt> for the
given forced parameter.
-     * <p/>
      * For example by graceful stopping any threads or the likes.
      * <p/>
+     * In addition a service can also be suspended (not stopped), and when this happens the
parameter
+     * <tt>suspendOnly</tt> has the value <tt>true</tt>. This can
be used to prepare the service
+     * for suspension, such as marking a worker thread to skip action.
+     * <p/>
      * For forced shutdown, then the service is expected to aggressively shutdown any child
services, such
      * as thread pools etc. This is the last chance it has to perform such duties.
      * 

http://git-wip-us.apache.org/repos/asf/camel/blob/d3c654f6/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorConsumer.java
b/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorConsumer.java
index a59f077..3806d50 100644
--- a/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorConsumer.java
+++ b/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorConsumer.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.disruptor;
 
 import java.util.HashSet;
@@ -114,7 +113,7 @@ public class DisruptorConsumer extends ServiceSupport implements Consumer,
Suspe
     }
 
     @Override
-    public void prepareShutdown(final boolean forced) {
+    public void prepareShutdown(boolean suspendOnly, boolean forced) {
         // nothing
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d3c654f6/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
index 71ed5b1..dd592d3 100644
--- a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
+++ b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
@@ -106,7 +106,7 @@ public class KestrelConsumer extends DefaultConsumer implements ShutdownAware
{
     }
 
     @Override
-    public void prepareShutdown(boolean forced) {
+    public void prepareShutdown(boolean suspendOnly, boolean forced) {
         // Signal to our threads that shutdown is happening
         shutdownPending = true;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d3c654f6/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
index bee0980..5d557d4 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
@@ -96,7 +96,7 @@ public class RouteboxDirectConsumer extends RouteboxServiceSupport implements
Ro
     }
 
     @Override
-    public void prepareShutdown(boolean forced) {
+    public void prepareShutdown(boolean suspendOnly, boolean forced) {
         // noop
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/d3c654f6/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
index 32dc64f..0bb9ca3 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
@@ -118,12 +118,15 @@ public class RouteboxSedaConsumer extends RouteboxServiceSupport implements
Rout
     }
 
     public int getPendingExchangesSize() {
-        // TODO: Get size of queue
+        BlockingQueue<Exchange> queue = ((RouteboxSedaEndpoint)getRouteboxEndpoint()).getQueue();
+        if (queue != null) {
+            return queue.size();
+        }
         return 0;
     }
 
     @Override
-    public void prepareShutdown(boolean forced) {
+    public void prepareShutdown(boolean suspendOnly, boolean forced) {
     }
     
     public void setProcessor(AsyncProcessor processor) {


Mime
View raw message