public synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, redeliveryDelay); }
public synchronized void stopConnectCheckTask() { if (connectCheckerTask != null) { LOG.trace("Stopping connection check task for: {}", this); connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; } } }
public synchronized void executePeriodically(final Runnable task, long period) { TimerTask existing = timerTasks.get(task); if (existing != null) { LOG.debug("Task {} already scheduled, cancelling and rescheduling", task); cancel(task); } TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, period, period); timerTasks.put(task, timerTask); }
protected synchronized void stopMonitorThreads() { stopConnectCheckTask(); if (monitorStarted.compareAndSet(true, false)) { if (readCheckerTask != null) { readCheckerTask.cancel(); } if (writeCheckerTask != null) { writeCheckerTask.cancel(); } synchronized (AbstractInactivityMonitor.class) { WRITE_CHECK_TIMER.purge(); READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; if (CHECKER_COUNTER == 0) { WRITE_CHECK_TIMER.cancel(); READ_CHECK_TIMER.cancel(); WRITE_CHECK_TIMER = null; READ_CHECK_TIMER = null; try { ThreadPoolUtils.shutdownGraceful(ASYNC_TASKS, TimeUnit.SECONDS.toMillis(10)); } finally { ASYNC_TASKS = null; } } } } }
public synchronized void startConnectCheckTask(long connectionTimeout) { if (connectionTimeout <= 0) { return; } LOG.trace("Starting connection check task for: {}", this); this.connectAttemptTimeout = connectionTimeout; if (connectCheckerTask == null) { connectCheckerTask = new SchedulerTimerTask(connectChecker); synchronized (AbstractInactivityMonitor.class) { if (CHECKER_COUNTER == 0) { if (ASYNC_TASKS == null || ASYNC_TASKS.isShutdown()) { ASYNC_TASKS = createExecutor(); } if (READ_CHECK_TIMER == null) { READ_CHECK_TIMER = new Timer("ActiveMQ InactivityMonitor ReadCheckTimer", true); } } CHECKER_COUNTER++; READ_CHECK_TIMER.schedule(connectCheckerTask, connectionTimeout); } } }
public synchronized void stopConnectCheckTask() { if (connectCheckerTask != null) { LOG.trace("Stopping connection check task for: {}", this); connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; } } }
readCheckerTask = new SchedulerTimerTask(readChecker); writeCheckerTask = new SchedulerTimerTask(writeChecker);
public synchronized void stopConnectCheckTask() { if (connectCheckerTask != null) { LOG.trace("Stopping connection check task for: {}", this); connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; } } }
public synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, redeliveryDelay); }
public synchronized void stopConnectCheckTask() { if (connectCheckerTask != null) { LOG.trace("Stopping connection check task for: {}", this); connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; } } }
public synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, redeliveryDelay); }
synchronized void stopConnectChecker() { if (connectCheckerTask != null) { connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; if (CHECKER_COUNTER == 0) { READ_CHECK_TIMER.cancel(); READ_CHECK_TIMER = null; } } } }
public synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, redeliveryDelay); }
public synchronized void stopKeepAliveTask() { if (keepAliveTask != null) { keepAliveTask.cancel(); keepAliveTask = null; synchronized (AbstractInactivityMonitor.class) { KEEPALIVE_TASK_TIMER.purge(); KEEPALIVE_TASK_COUNTER--; if (KEEPALIVE_TASK_COUNTER == 0) { KEEPALIVE_TASK_TIMER.cancel(); KEEPALIVE_TASK_TIMER = null; } } } }
public synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, redeliveryDelay); }
synchronized void stopReadChecker() { if (readCheckerTask != null) { readCheckerTask.cancel(); readCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; if (CHECKER_COUNTER == 0) { READ_CHECK_TIMER.cancel(); READ_CHECK_TIMER = null; } } } }
public void executePeriodically(final Runnable task, long period) { TimerTask timerTask = new SchedulerTimerTask(task); timer.scheduleAtFixedRate(timerTask, period, period); timerTasks.put(task, timerTask); }
public synchronized void stopConnectionTimeoutChecker() { if (connectCheckerTask != null) { connectCheckerTask.cancel(); connectCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { CONNECTION_CHECK_TASK_TIMER.purge(); CONNECTION_CHECK_TASK_COUNTER--; if (CONNECTION_CHECK_TASK_COUNTER == 0) { CONNECTION_CHECK_TASK_TIMER.cancel(); CONNECTION_CHECK_TASK_TIMER = null; } } } }
public synchronized void schedualPeriodically(final Runnable task, long period) { TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, period, period); timerTasks.put(task, timerTask); }
synchronized void stopReadChecker() { if (readCheckerTask != null) { readCheckerTask.cancel(); readCheckerTask = null; synchronized (AbstractInactivityMonitor.class) { READ_CHECK_TIMER.purge(); CHECKER_COUNTER--; if (CHECKER_COUNTER == 0) { READ_CHECK_TIMER.cancel(); READ_CHECK_TIMER = null; } } } }