You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/01/28 15:49:25 UTC

[camel] branch master updated (54bec7f -> 1791b63)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 54bec7f  CAMEL-14354: camel-core optimize
     new 945548c  CAMEL-14354: camel-core optimize
     new 1791b63  CAMEL-14354: camel-timer optimize

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/camel/component/timer/TimerConsumer.java   |  5 ++---
 .../java/org/apache/camel/support/service/ServiceSupport.java  | 10 +++++-----
 .../test/java/org/apache/camel/support/ServiceSupportTest.java |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)


[camel] 02/02: CAMEL-14354: camel-timer optimize

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1791b631ef1f1220a1288b149498539c910dc441
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 28 16:44:37 2020 +0100

    CAMEL-14354: camel-timer optimize
---
 .../main/java/org/apache/camel/component/timer/TimerConsumer.java    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/components/camel-timer/src/main/java/org/apache/camel/component/timer/TimerConsumer.java b/components/camel-timer/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
index 1204478..fdf97af 100644
--- a/components/camel-timer/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
+++ b/components/camel-timer/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
@@ -146,9 +146,8 @@ public class TimerConsumer extends DefaultConsumer implements StartupListener, S
      * Whether the timer task is allow to run or not
      */
     protected boolean isTaskRunAllowed() {
-        // only allow running the timer task if we can run and are not suspended,
-        // and CamelContext must have been fully started
-        return endpoint.getCamelContext().getStatus().isStarted() && isRunAllowed() && !isSuspended();
+        // only run if we are started
+        return isStarted();
     }
 
     protected void configureTask(TimerTask task, Timer timer) {


[camel] 01/02: CAMEL-14354: camel-core optimize

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 945548c4d1c45084aa1062c9a98cda2f8f7a4351
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 28 16:07:45 2020 +0100

    CAMEL-14354: camel-core optimize
---
 .../java/org/apache/camel/support/service/ServiceSupport.java  | 10 +++++-----
 .../test/java/org/apache/camel/support/ServiceSupportTest.java |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java b/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
index 7b2f780..2f8b04d 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
@@ -307,7 +307,7 @@ public abstract class ServiceSupport implements StatefulService {
 
     @Override
     public boolean isStopped() {
-        return status == NEW || status == INITIALIZED || status == BUILDED || status == STOPPED || status == SHUTTINGDOWN || status == SHUTDOWN || status == FAILED;
+        return status < STARTING || status >= STOPPED;
     }
 
     @Override
@@ -322,7 +322,7 @@ public abstract class ServiceSupport implements StatefulService {
 
     @Override
     public boolean isRunAllowed() {
-        return isStartingOrStarted() || isSuspendingOrSuspended();
+        return status >= STARTING && status <= SUSPENDED;
     }
 
     public boolean isShutdown() {
@@ -333,21 +333,21 @@ public abstract class ServiceSupport implements StatefulService {
      * Is the service in progress of being stopped or already stopped
      */
     public boolean isStoppingOrStopped() {
-        return isStopping() || isStopped();
+        return status < STARTING || status > SUSPENDED;
     }
 
     /**
      * Is the service in progress of being suspended or already suspended
      */
     public boolean isSuspendingOrSuspended() {
-        return isSuspending() || isSuspended();
+        return status == SUSPENDING || status == SUSPENDED;
     }
 
     /**
      * Is the service in progress of being suspended or already suspended
      */
     public boolean isStartingOrStarted() {
-        return isStarting() || isStarted();
+        return status == STARTING || status == STARTED;
     }
 
     /**
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/ServiceSupportTest.java b/core/camel-core/src/test/java/org/apache/camel/support/ServiceSupportTest.java
index c1655cd..ebed281 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/ServiceSupportTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/ServiceSupportTest.java
@@ -158,7 +158,7 @@ public class ServiceSupportTest extends TestSupport {
 
         public ServiceSupportTestExOnStart() {
             // just for testing force it to not be stopped
-            status = -1;
+            status = SUSPENDED;
         }
 
         @Override