@Override public void run() { while (TICK == this) { try { Item first = obtainFirst(); if (first != null) { first.owner.enqueue(first); } } catch (InterruptedException ex) { continue; } } }
void schedule(long delay) { if (stopped) { return; } time = System.currentTimeMillis() + delay; final Item localItem; synchronized (processorLock) { if (cancelled != null) { cancelled.set(false); } notifyRunning(); if (item != null) { item.clear(null); } item = enableStackTraces ? new SlowItem(this, RequestProcessor.this) : new FastItem(this, RequestProcessor.this); localItem = item; } if (delay == 0) { // Place it to pending queue immediatelly enqueue(localItem); } else { // Post the starter TickTac.schedule(localItem, delay); } }
public void run() { try { enqueue(itm); } catch (RuntimeException e) { Exceptions.printStackTrace(e); } } }
@Override public void run() { while (TICK == this) { try { Item first = obtainFirst(); if (first != null) { first.owner.enqueue(first); } } catch (InterruptedException ex) { continue; } } }
enqueue(localItem); } else { // Post the starter starterThread.schedule( new TimerTask() {
enqueue(localItem); } else { // Post the starter starterThread.schedule( new TimerTask() {
/** (Re-)schedules a task to run in the future. * If the task has not been run yet, it is postponed to * the new time. If it has already run and finished, it is scheduled * to be started again. If it is currently running, it is nevertheless * left to finish, and also scheduled to run again. * @param delay time in milliseconds to wait (starting from now) */ public void schedule(int delay) { if (stopped) { throw new IllegalStateException("RequestProcessor already stopped!"); // NOI18N } time = System.currentTimeMillis() + delay; final Item localItem; synchronized (processorLock) { notifyRunning(); if (item != null) { item.clear(null); } item = new Item(this, RequestProcessor.this); localItem = item; } if (delay == 0) { // Place it to pending queue immediatelly enqueue(localItem); } else { // Post the starter starterThread.schedule(new EnqueueTask(localItem), delay); } }
void schedule(long delay) { if (stopped) { return; } time = System.currentTimeMillis() + delay; final Item localItem; synchronized (processorLock) { if (cancelled != null) { cancelled.set(false); } notifyRunning(); if (item != null) { item.clear(null); } item = enableStackTraces ? new SlowItem(this, RequestProcessor.this) : new FastItem(this, RequestProcessor.this); localItem = item; } if (delay == 0) { // Place it to pending queue immediatelly enqueue(localItem); } else { // Post the starter TickTac.schedule(localItem, delay); } }