long checkCalls() { final long startTime = Time.monotonicNow(); long minWaitTime = Processor.MAX_WAIT_PERIOD; for (final Iterator<AsyncCall> i = queue.iterator(); i.hasNext();) { final AsyncCall c = i.next(); if (c.isDone()) { i.remove(); // the call is done, remove it from the queue. queue.checkEmpty(); } else { final Long waitTime = c.getWaitTime(startTime); if (waitTime != null && waitTime > 0 && waitTime < minWaitTime) { minWaitTime = waitTime; } } } return minWaitTime; }
void addCall(AsyncCall call) { if (LOG.isDebugEnabled()) { LOG.debug("add " + call); } queue.offer(call); processor.tryStart(); }
long checkCalls() { final long startTime = Time.monotonicNow(); long minWaitTime = Processor.MAX_WAIT_PERIOD; for (final Iterator<AsyncCall> i = queue.iterator(); i.hasNext();) { final AsyncCall c = i.next(); if (c.isDone()) { i.remove(); // the call is done, remove it from the queue. queue.checkEmpty(); } else { final Long waitTime = c.getWaitTime(startTime); if (waitTime != null && waitTime > 0 && waitTime < minWaitTime) { minWaitTime = waitTime; } } } return minWaitTime; }
void tryStop(Daemon d) { if (queue.isEmpty(GRACE_PERIOD)) { kill(d); } }
void addCall(AsyncCall call) { if (LOG.isDebugEnabled()) { LOG.debug("add " + call); } queue.offer(call); processor.tryStart(); }
void tryStop(Daemon d) { if (queue.isEmpty(GRACE_PERIOD)) { kill(d); } }