List of usage examples for java.util.concurrent Delayed getDelay
long getDelay(TimeUnit unit);
From source file:DelayedJob.java
@Override public int compareTo(Delayed job) { long currentJobDelay = this.getDelay(MILLISECONDS); long jobDelay = job.getDelay(MILLISECONDS); int diff = 0; if (currentJobDelay > jobDelay) { diff = 1;/*from w ww. ja v a 2 s . com*/ } else if (currentJobDelay < jobDelay) { diff = -1; } return diff; }
From source file:be.vlaanderen.sesam.monitor.internal.util.ReschedulingRunnable.java
public int compareTo(Delayed other) { if (this == other) { return 0; }//ww w . java 2 s.c o m long diff = getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS); return (diff == 0 ? 0 : ((diff < 0) ? -1 : 1)); }
From source file:org.archive.crawler.frontier.WorkQueueFrontier.java
@Override protected long getMaxInWait() { Delayed next = snoozedClassQueues.peek(); return next == null ? 60000 : next.getDelay(TimeUnit.MILLISECONDS); }
From source file:org.apache.falcon.notification.service.request.DataNotificationRequest.java
@Override public int compareTo(Delayed other) { return (int) (this.getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS)); }
From source file:org.apache.hadoop.hbase.master.RegionServerOperation.java
public int compareTo(Delayed o) { return Long.valueOf(getDelay(TimeUnit.MILLISECONDS) - o.getDelay(TimeUnit.MILLISECONDS)).intValue(); }
From source file:org.apache.hadoop.mapred.gridmix.GridmixJob.java
@Override public int compareTo(Delayed other) { if (this == other) { return 0; }// ww w . ja va 2 s . co m if (other instanceof GridmixJob) { final long otherNanos = ((GridmixJob) other).submissionTimeNanos; if (otherNanos < submissionTimeNanos) { return 1; } if (otherNanos > submissionTimeNanos) { return -1; } return id() - ((GridmixJob) other).id(); } final long diff = getDelay(TimeUnit.NANOSECONDS) - other.getDelay(TimeUnit.NANOSECONDS); return 0 == diff ? 0 : (diff > 0 ? 1 : -1); }
From source file:org.opennms.sms.reflector.smsservice.MobileMsgRequest.java
/** * <p>compareTo</p>//from ww w . ja v a2 s . c o m * * @param o a {@link java.util.concurrent.Delayed} object. * @return a int. */ @Override public int compareTo(Delayed o) { long thisVal = this.getDelay(TimeUnit.NANOSECONDS); long anotherVal = o.getDelay(TimeUnit.NANOSECONDS); return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1)); }