void stop() throws JMSException { try { if (messageQueue.isRunning()) { synchronized(this) { messageQueue.stop(); if (this.taskRunner != null) { this.taskRunner.shutdown(); this.taskRunner = null; } } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw JMSExceptionSupport.create(e); } }
@Override public void run() { try { Topic.this.taskRunner.wakeup(); } catch (InterruptedException e) { } } };
private void asyncWakeup() { try { pendingWakeups.incrementAndGet(); this.taskRunner.wakeup(); } catch (InterruptedException e) { LOG.warn("Async task runner failed to wakeup ", e); } }
@Override public void stop() throws Exception { try { synchronized (reconnectMutex) { ServiceStopper ss = new ServiceStopper(); if (!started) { return; } started = false; disposed = true; connected = false; for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) { FanoutTransportHandler th = iter.next(); if (th.transport != null) { ss.stop(th.transport); } } LOG.debug("Stopped: " + this); ss.throwFirstException(); } } finally { reconnectTask.shutdown(); reconnectTaskFactory.shutdownNow(); } }
public void reconnect() { LOG.debug("Waking up reconnect task"); try { reconnectTask.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
reconnectTask.shutdown(); reconnectTaskFactory.shutdownNow();
public void reconnect(boolean rebalance) { synchronized (reconnectMutex) { if (started) { if (rebalance) { doRebalance = true; } LOG.debug("Waking up reconnect task"); try { reconnectTask.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } else { LOG.debug("Reconnect was triggered but transport is not started yet. Wait for start to connect the transport."); } } }
@Override public void stop() throws Exception { if (started.compareAndSet(true, false)) { if (taskRunner != null) { taskRunner.shutdown(); } this.subscriptionRecoveryPolicy.stop(); if (memoryUsage != null) { memoryUsage.stop(); } if (this.topicStore != null) { this.topicStore.stop(); } scheduler.cancel(expireMessagesTask); } }
public void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage) { // Do we need to start evicting cache entries? Usage > than the // high mark if (oldPercentUsage < newPercentUsage && usage.getPercentUsage() >= usageHighMark) { try { evictionTask.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
@Override public void stop() throws Exception { this.usageManager.getMemoryUsage().removeUsageListener(this); if (!started.compareAndSet(true, false)) { return; } this.scheduler.cancel(periodicCheckpointTask); this.scheduler.stop(); // Take one final checkpoint and stop checkpoint processing. checkpoint(true, true); checkpointTask.shutdown(); ThreadPoolUtils.shutdown(checkpointExecutor); checkpointExecutor = null; queues.clear(); topics.clear(); IOException firstException = null; try { journal.close(); } catch (Exception e) { firstException = IOExceptionSupport.create("Failed to close journals: " + e, e); } longTermPersistence.stop(); if (firstException != null) { throw firstException; } }
protected void wakeup() { if (async && started.get()) { try { getTaskRunner().wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (TransportDisposedIOException e) { } } }
tr.shutdown(1); } catch(Exception e) {
/** * When we checkpoint we move all the journalled data to long term storage. * */ public void checkpoint(boolean sync, boolean fullCheckpoint) { try { if (journal == null) { throw new IllegalStateException("Journal is closed."); } long now = System.currentTimeMillis(); CountDownLatch latch = null; synchronized (this) { latch = nextCheckpointCountDownLatch; lastCheckpointRequest = now; if (fullCheckpoint) { this.fullCheckPoint = true; } } checkpointTask.wakeup(); if (sync) { LOG.debug("Waking for checkpoint to complete."); latch.await(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.warn("Request to start checkpoint failed: " + e, e); } }
taskRunner.shutdown(1); taskRunner = null;
if (started.compareAndSet(true, false)) { if (taskRunner != null) { taskRunner.shutdown();
@Override public void onException(IOException error) { try { synchronized (reconnectMutex) { if (transport == null || !transport.isConnected()) { return; } LOG.debug("Transport failed, starting up reconnect task", error); ServiceSupport.dispose(transport); transport = null; connectedCount--; if (primary == this) { primary = null; } reconnectTask.wakeup(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (transportListener != null) { transportListener.onException(new InterruptedIOException()); } } } }
public void stop() throws Exception { flush(); asyncWriteTask.shutdown(); referenceStore.stop(); }
@Override public void dispatchAsync(Command message) { if (!stopping.get()) { if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; TransmitCallback sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.onFailure(); } } } }
public void stop() throws Exception { Transport transportToStop = null; synchronized (reconnectMutex) { LOG.debug("Stopped."); if (!started) { return; } started = false; disposed = true; connected = false; for (BackupTransport t : backups) { t.setDisposed(true); } backups.clear(); if (connectedTransport.get() != null) { transportToStop = connectedTransport.getAndSet(null); } reconnectMutex.notifyAll(); } synchronized (sleepMutex) { sleepMutex.notifyAll(); } reconnectTask.shutdown(); if (transportToStop != null) { transportToStop.stop(); } }