Title: [1053] trunk/servicemix-core/src/main/java/org/servicemix/components/util/PollingComponentSupport.java: Better code organization
Revision
1053
Author
gastaldi
Date
2005-12-08 17:29:36 -0500 (Thu, 08 Dec 2005)

Log Message

Better code organization

Modified Paths


Diff

Modified: trunk/servicemix-core/src/main/java/org/servicemix/components/util/PollingComponentSupport.java (1052 => 1053)

--- trunk/servicemix-core/src/main/java/org/servicemix/components/util/PollingComponentSupport.java	2005-12-08 22:14:40 UTC (rev 1052)
+++ trunk/servicemix-core/src/main/java/org/servicemix/components/util/PollingComponentSupport.java	2005-12-08 22:29:36 UTC (rev 1053)
@@ -112,18 +112,7 @@
             if (timerTask != null) {
                 timerTask.cancel();
             }
-            timerTask = new TimerTask() {
-                public void run() {
-                    try {
-                        // lets run the work inside the JCA worker pools to ensure
-                        // the threads are setup correctly when we actually do stuff
-                        getWorkManager().scheduleWork(PollingComponentSupport.this);
-                    }
-                    catch (Throwable e) {
-                        log.error("Failed to schedule work: " + e, e);
-                    }
-                }
-            };
+            timerTask = new PollTimerTask();
             if (firstTime != null) {
                 timer.scheduleAtFixedRate(timerTask, firstTime, period);
             }
@@ -162,4 +151,18 @@
         super.init();
        
     }
+    
+    private class PollTimerTask extends TimerTask {
+    	public void run() {
+	        try {
+	            // lets run the work inside the JCA worker pools to ensure
+	            // the threads are setup correctly when we actually do stuff
+	            getWorkManager().scheduleWork(PollingComponentSupport.this);
+	        }
+	        catch (Throwable e) {
+	            log.error("Failed to schedule work: " + e, e);
+	        }
+    	}
+    }
+    
 }

Reply via email to