camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r772501 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/impl: DefaultComponent.java DefaultEndpoint.java
Date Thu, 07 May 2009 04:51:48 GMT
Author: davsclaus
Date: Thu May  7 04:51:48 2009
New Revision: 772501

URL: http://svn.apache.org/viewvc?rev=772501&view=rev
Log:
CAMEL-1587: Fixed compilation error

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java?rev=772501&r1=772500&r2=772501&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java Thu May
 7 04:51:48 2009
@@ -149,21 +149,30 @@
         this.camelContext = context;
     }
 
-    public ExecutorService getExecutorService() {
+    public synchronized ExecutorService getExecutorService() {
         if (executorService == null) {
-            executorService = createExecutorService();
+            executorService = createScheduledExecutorService();
         }
         return executorService;
     }
 
-    public void setExecutorService(ScheduledExecutorService executorService) {
+    public synchronized void setExecutorService(ExecutorService executorService) {
         this.executorService = executorService;
     }
-    
+
+    public synchronized ScheduledExecutorService getScheduledExecutorService() {
+        ExecutorService executor = getExecutorService();
+        if (executor instanceof ScheduledExecutorService) {
+            return (ScheduledExecutorService) executor;
+        } else {
+            return createScheduledExecutorService();
+        }
+    }
+
     /**
      * A factory method to create a default thread pool and executor
      */
-    protected ExecutorService createExecutorService() {
+    protected ScheduledExecutorService createScheduledExecutorService() {
         return ExecutorServiceHelper.newScheduledThreadPool(DEFAULT_THREADPOOL_SIZE, this.toString(),
true);
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=772501&r1=772500&r2=772501&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java Thu May
 7 04:51:48 2009
@@ -112,13 +112,22 @@
                 executorService = dc.getExecutorService();
             }
             if (executorService == null) {
-                executorService = createExecutorService();
+                executorService = createScheduledExecutorService();
             }
         }
         return executorService;
     }
+    
+    public synchronized ScheduledExecutorService getScheduledExecutorService() {
+        ExecutorService executor = getExecutorService();
+        if (executor instanceof ScheduledExecutorService) {
+            return (ScheduledExecutorService) executor;
+        } else {
+            return createScheduledExecutorService();
+        }
+    }
 
-    public synchronized void setExecutorService(ScheduledExecutorService executorService)
{
+    public synchronized void setExecutorService(ExecutorService executorService) {
         this.executorService = executorService;
     }
 
@@ -183,7 +192,7 @@
         this.exchangePattern = exchangePattern;
     }
 
-    protected ExecutorService createExecutorService() {
+    protected ScheduledExecutorService createScheduledExecutorService() {
         return ExecutorServiceHelper.newScheduledThreadPool(DEFAULT_THREADPOOL_SIZE, getEndpointUri(),
true);
     }
 



Mime
View raw message