camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1023871 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
Date Mon, 18 Oct 2010 15:55:57 GMT
Author: davsclaus
Date: Mon Oct 18 15:55:57 2010
New Revision: 1023871

URL: http://svn.apache.org/viewvc?rev=1023871&view=rev
Log:
Fixed a potential NPE

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java?rev=1023871&r1=1023870&r2=1023871&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
Mon Oct 18 15:55:57 2010
@@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFac
 public class TimerConsumer extends DefaultConsumer {
     private static final transient Log LOG = LogFactory.getLog(TimerConsumer.class);
     private final TimerEndpoint endpoint;
-    private TimerTask task;
+    private volatile TimerTask task;
 
     public TimerConsumer(TimerEndpoint endpoint, Processor processor) {
         super(endpoint, processor);
@@ -56,7 +56,9 @@ public class TimerConsumer extends Defau
 
     @Override
     protected void doStop() throws Exception {
-        task.cancel();
+        if (task != null) {
+            task.cancel();
+        }
         task = null;
     }
 



Mime
View raw message