@Override public void run() { while (true) { if (Thread.currentThread().isInterrupted()) { return; } try { if (doRun()) { return; } } catch (InterruptedException e) { // restore the interrupt Thread.currentThread().interrupt(); return; } catch (Throwable t) { logger.warning(t); } } }
private boolean doRun() throws Exception { long waitTime = FIRST_WAIT_TIME; while (waitTime > 0) { long begin = System.currentTimeMillis(); WaitSetEntry entry = (WaitSetEntry) delayQueue.poll(waitTime, MILLISECONDS); if (entry != null) { if (entry.isValid()) { invalidate(entry); } } long end = System.currentTimeMillis(); waitTime -= (end - begin); if (waitTime > FIRST_WAIT_TIME) { waitTime = FIRST_WAIT_TIME; } } for (WaitSet waitSet : waitSetMap.values()) { if (Thread.interrupted()) { return true; } for (WaitSetEntry entry : waitSet) { if (entry.isValid() && entry.needsInvalidation()) { invalidate(entry); } } } return false; }
private boolean doRun() throws Exception { long waitTime = FIRST_WAIT_TIME; while (waitTime > 0) { long begin = System.currentTimeMillis(); WaitSetEntry entry = (WaitSetEntry) delayQueue.poll(waitTime, MILLISECONDS); if (entry != null) { if (entry.isValid()) { invalidate(entry); } } long end = System.currentTimeMillis(); waitTime -= (end - begin); if (waitTime > FIRST_WAIT_TIME) { waitTime = FIRST_WAIT_TIME; } } for (WaitSet waitSet : waitSetMap.values()) { if (Thread.interrupted()) { return true; } for (WaitSetEntry entry : waitSet) { if (entry.isValid() && entry.needsInvalidation()) { invalidate(entry); } } } return false; }
@Override public void run() { while (true) { if (Thread.currentThread().isInterrupted()) { return; } try { if (doRun()) { return; } } catch (InterruptedException e) { // restore the interrupt Thread.currentThread().interrupt(); return; } catch (Throwable t) { logger.warning(t); } } }
public OperationParkerImpl(NodeEngineImpl nodeEngine) { this.nodeEngine = nodeEngine; Node node = nodeEngine.getNode(); this.logger = node.getLogger(OperationParker.class); this.expirationExecutor = Executors.newSingleThreadExecutor( new SingleExecutorThreadFactory(node.getConfigClassLoader(), createThreadName(nodeEngine.getHazelcastInstance().getName(), "operation-parker"))); this.expirationTaskFuture = expirationExecutor.submit(new ExpirationTask()); }
public OperationParkerImpl(NodeEngineImpl nodeEngine) { this.nodeEngine = nodeEngine; Node node = nodeEngine.getNode(); this.logger = node.getLogger(OperationParker.class); this.expirationExecutor = Executors.newSingleThreadExecutor( new SingleExecutorThreadFactory(node.getConfigClassLoader(), createThreadName(nodeEngine.getHazelcastInstance().getName(), "operation-parker"))); this.expirationTaskFuture = expirationExecutor.submit(new ExpirationTask()); }