ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ScheduledThreadPoolExecutor.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ScheduledThreadPoolExecutor.java (file contents):
Revision 1.33 by jsr166, Thu Sep 8 21:58:22 2005 UTC vs.
Revision 1.34 by dl, Tue Dec 13 00:13:36 2005 UTC

# Line 148 | Line 148 | public class ScheduledThreadPoolExecutor
148          public int compareTo(Delayed other) {
149              if (other == this) // compare zero ONLY if same object
150                  return 0;
151 <            ScheduledFutureTask<?> x = (ScheduledFutureTask<?>)other;
152 <            long diff = time - x.time;
153 <            if (diff < 0)
154 <                return -1;
155 <            else if (diff > 0)
156 <                return 1;
157 <            else if (sequenceNumber < x.sequenceNumber)
158 <                return -1;
159 <            else
160 <                return 1;
151 >            if (other instanceof ScheduledFutureTask) {
152 >                ScheduledFutureTask<?> x = (ScheduledFutureTask<?>)other;
153 >                long diff = time - x.time;
154 >                if (diff < 0)
155 >                    return -1;
156 >                else if (diff > 0)
157 >                    return 1;
158 >                else if (sequenceNumber < x.sequenceNumber)
159 >                    return -1;
160 >                else
161 >                    return 1;
162 >            }
163 >            long d = (getDelay(TimeUnit.NANOSECONDS) -
164 >                      other.getDelay(TimeUnit.NANOSECONDS));
165 >            return (d == 0)? 0 : ((d < 0)? -1 : 1);
166          }
167  
168          /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines