Author: jonesde
Date: Wed Dec  5 08:01:51 2007
New Revision: 601382

URL: http://svn.apache.org/viewvc?rev=601382&view=rev
Log:
Added comments and an if to protect a call to remove just in case this method 
is used in the future in anything other than the JobInvoker.run method

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java?rev=601382&r1=601381&r2=601382&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java Wed 
Dec  5 08:01:51 2007
@@ -167,8 +167,12 @@
      */
     public Job next() {
         if (run.size() > 0) {
+               // NOTE: this syncrhonized isn't really necessary as the only 
method that calls it is already synchronized (the JobInvoker.run method), so 
this is here as an added protection especially for the case where it might be 
used differently in the future
                synchronized (run) {
-                       return run.remove(0);
+                       // make sure the size is still greater than zero
+                if (run.size() > 0) {
+                       return run.remove(0);
+                }
                }
         }
         return null;


Reply via email to