Author: jcompagner
Date: Sun Dec 16 10:37:12 2007
New Revision: 604667

URL: http://svn.apache.org/viewvc?rev=604667&view=rev
Log:
reset the isStarted boolean WICKET-1181

Modified:
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java?rev=604667&r1=604666&r2=604667&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/thread/Task.java
 Sun Dec 16 10:37:12 2007
@@ -97,34 +97,46 @@
                                        startTime.fromNow().sleep();
                                        final Logger log = getLog();
 
-                                       while (!stop)
+                                       try
                                        {
-                                               // Get the start of the current 
period
-                                               final Time startOfPeriod = 
Time.now();
-
-                                               if (log.isTraceEnabled())
+                                               while (!stop)
                                                {
-                                                       log.trace("Run the job: 
" + code.toString());
-                                               }
+                                                       // Get the start of the 
current period
+                                                       final Time 
startOfPeriod = Time.now();
 
-                                               try
-                                               {
-                                                       // Run the user's code
-                                                       code.run(getLog());
-                                               }
-                                               catch (Exception e)
-                                               {
-                                                       log.error("Unhandled 
exception thrown by user code in task " + name, e);
-                                               }
+                                                       if 
(log.isTraceEnabled())
+                                                       {
+                                                               log.trace("Run 
the job: " + code.toString());
+                                                       }
 
-                                               if (log.isTraceEnabled())
-                                               {
-                                                       log.trace("Finished 
with job: " + code.toString());
-                                               }
+                                                       try
+                                                       {
+                                                               // Run the 
user's code
+                                                               
code.run(getLog());
+                                                       }
+                                                       catch (Exception e)
+                                                       {
+                                                               log.error(
+                                                                       
"Unhandled exception thrown by user code in task " + name, e);
+                                                       }
+
+                                                       if 
(log.isTraceEnabled())
+                                                       {
+                                                               
log.trace("Finished with job: " + code.toString());
+                                                       }
 
-                                               // Sleep until the period is 
over (or not at all if it's
-                                               // already passed)
-                                               
startOfPeriod.add(frequency).fromNow().sleep();
+                                                       // Sleep until the 
period is over (or not at all if it's
+                                                       // already passed)
+                                                       
startOfPeriod.add(frequency).fromNow().sleep();
+                                               }
+                                       }
+                                       catch (Throwable t)
+                                       {
+                                               log.error("Task " + name + " 
terminated", t);
+                                       }
+                                       finally
+                                       {
+                                               isStarted = false;
                                        }
                                }
                        };


Reply via email to