You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2017/01/17 09:03:00 UTC

camel git commit: CAMEL-10707: fixing suspend/resume

Repository: camel
Updated Branches:
  refs/heads/master dff9f28cd -> ed61ae084


CAMEL-10707: fixing suspend/resume


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

Branch: refs/heads/master
Commit: ed61ae08467ffa6b3fb515140cca75381aa9020a
Parents: dff9f28
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Tue Jan 17 09:56:57 2017 +0100
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Tue Jan 17 09:56:57 2017 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/Suspendable.java     |  2 ++
 .../main/java/org/apache/camel/util/ServiceHelper.java  | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ed61ae08/camel-core/src/main/java/org/apache/camel/Suspendable.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/Suspendable.java b/camel-core/src/main/java/org/apache/camel/Suspendable.java
index c1030cd..ae0f5ab 100644
--- a/camel-core/src/main/java/org/apache/camel/Suspendable.java
+++ b/camel-core/src/main/java/org/apache/camel/Suspendable.java
@@ -24,6 +24,8 @@ package org.apache.camel;
  * The {@link org.apache.camel.support.ServiceSupport} implementation that most Camel components / endpoints etc use
  * as base class is a {@link SuspendableService} but the actual implementation may not have special logic for suspend.
  * Therefore this marker interface is introduced to indicate when the implementation has special code for suspension.
+ * <p/>
+ * It is assumed that a service having a custom logic for suspension implements also a custom logic for resuming.
  *
  * @see SuspendableService
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/ed61ae08/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
index e0b4d77..91010dc 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
@@ -291,13 +291,13 @@ public final class ServiceHelper {
     /**
      * Resumes the given {@code service}.
      * <p/>
-     * If {@code service} is a {@link org.apache.camel.SuspendableService} then
-     * it's {@link org.apache.camel.SuspendableService#resume()} is called but
+     * If {@code service} is both {@link org.apache.camel.Suspendable} and {@link org.apache.camel.SuspendableService} then
+     * its {@link org.apache.camel.SuspendableService#resume()} is called but
      * <b>only</b> if {@code service} is already {@link #isSuspended(Object)
      * suspended}.
      * <p/>
      * If {@code service} is <b>not</b> a
-     * {@link org.apache.camel.SuspendableService} then it's
+     * {@link org.apache.camel.Suspendable} and {@link org.apache.camel.SuspendableService} then its
      * {@link org.apache.camel.Service#start()} is called.
      * <p/>
      * Calling this method has no effect if {@code service} is {@code null}.
@@ -310,7 +310,7 @@ public final class ServiceHelper {
      * @see #startService(Service)
      */
     public static boolean resumeService(Object service) throws Exception {
-        if (service instanceof SuspendableService) {
+        if (service instanceof Suspendable && service instanceof SuspendableService) {
             SuspendableService ss = (SuspendableService) service;
             if (ss.isSuspended()) {
                 LOG.debug("Resuming service {}", service);
@@ -363,12 +363,12 @@ public final class ServiceHelper {
      * Suspends the given {@code service}.
      * <p/>
      * If {@code service} is both {@link org.apache.camel.Suspendable} and {@link org.apache.camel.SuspendableService} then
-     * it's {@link org.apache.camel.SuspendableService#suspend()} is called but
+     * its {@link org.apache.camel.SuspendableService#suspend()} is called but
      * <b>only</b> if {@code service} is <b>not</b> already
      * {@link #isSuspended(Object) suspended}.
      * <p/>
      * If {@code service} is <b>not</b> a
-     * {@link org.apache.camel.Suspendable} and {@link org.apache.camel.SuspendableService} then it's
+     * {@link org.apache.camel.Suspendable} and {@link org.apache.camel.SuspendableService} then its
      * {@link org.apache.camel.Service#stop()} is called.
      * <p/>
      * Calling this method has no effect if {@code service} is {@code null}.