labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r679712 - /labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java
Date Fri, 25 Jul 2008 08:56:00 GMT
Author: thorsten
Date: Fri Jul 25 01:56:00 2008
New Revision: 679712

URL: http://svn.apache.org/viewvc?rev=679712&view=rev
Log:
LABS-138 fix submitted by Javier Puerto. thank you very much Javier

Modified:
    labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java

Modified: labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java?rev=679712&r1=679711&r2=679712&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/queue/Simple.java Fri Jul 25 01:56:00
2008
@@ -69,10 +69,11 @@
   }
 
   public boolean hasNext() {
-      if (null == getToDoTasks()) {
+      Task[] toDoTasks = getToDoTasks();
+	if (null == toDoTasks) {
         return false;
       }
-      return getToDoTasks().length > 0;
+      return toDoTasks.length > 0;
   }
 
   public void merge(Task[] filterLinks) {
@@ -101,16 +102,17 @@
       setToDoLinks(list.toArray(new Task[list.size()]));
   }
 
-  public Task next() {
-      if (getToDoTasks() == null || getToDoTasks().length < 1) {
+  public synchronized Task next() {
+      Task[] toDoTasks = getToDoTasks();
+	if (toDoTasks == null || toDoTasks.length < 1) {
         return null;
       }
 
-      Task task = getToDoTasks()[0];
-      if (getToDoTasks().length > 1) {
-        Task[] newToDoLinks = new Task[getToDoTasks().length - 1];
-        for (int i = 1; i < getToDoTasks().length; i++) {
-          Task taskOld = getToDoTasks()[i];
+      Task task = toDoTasks[0];
+      if (toDoTasks.length > 1) {
+        Task[] newToDoLinks = new Task[toDoTasks.length - 1];
+        for (int i = 1; i < toDoTasks.length; i++) {
+          Task taskOld = toDoTasks[i];
           newToDoLinks[i - 1] = taskOld;
         }
         setToDoLinks(newToDoLinks);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message