protected void doInit() throws Exception { taskRunnerFactory.execute(new Runnable() { @Override public void run() { //Need to start in new thread to let startup finish first //We can trigger a read because we know the channel is ready since the SSL handshake //already happened serviceRead(); initialized.countDown(); } }); }
@Override public void execute(Runnable runnable) { execute(runnable, name); }
@Override public void run() { if (purgeInactiveDestinationsTaskInProgress.compareAndSet(false, true)) { taskRunnerFactory.execute(purgeInactiveDestinationsWork); } } };
@Override public void run() { if (expiryTaskInProgress.compareAndSet(false, true)) { taskFactory.execute(expireMessagesWork); } } };
@Override public void run() { if (expiryTaskInProgress.compareAndSet(false, true)) { taskRunnerFactor.execute(expireMessagesWork); } } };
public void delayedStop(final int waitTime, final String reason, Throwable cause) { if (waitTime > 0) { status.compareAndSet(STARTING, PENDING_STOP); transportException.set(cause); try { stopTaskRunnerFactory.execute(new Runnable() { @Override public void run() { try { Thread.sleep(waitTime); stopAsync(); LOG.info("Stopping {} because {}", transport.getRemoteAddress(), reason); } catch (InterruptedException e) { } } }); } catch (Throwable t) { LOG.warn("Cannot create stopAsync. This exception will be ignored.", t); } } }
protected void triggerStartAsyncNetworkBridgeCreation() throws IOException { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { final String originalName = Thread.currentThread().getName(); Thread.currentThread().setName("triggerStartAsyncNetworkBridgeCreation: " + "remoteBroker=" + remoteBroker + ", localBroker= " + localBroker); try { // First we collect the info data from both the local and remote ends collectBrokerInfos(); // Once we have all required broker info we can attempt to start // the local and then remote sides of the bridge. doStartLocalAndRemoteBridges(); } finally { Thread.currentThread().setName(originalName); } } }); }
@Override public void serviceRemoteException(Throwable error) { if (!disposed.get()) { if (error instanceof SecurityException || error instanceof GeneralSecurityException) { LOG.error("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{ localBroker, remoteBroker, error }); } else { LOG.warn("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{ localBroker, remoteBroker, error }); } LOG.debug("The remote Exception was: {}", error, error); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { ServiceSupport.dispose(getControllingService()); } }); fireBridgeFailed(error); } }
taskRunnerFactory.execute(new Runnable() { @Override public void run() {
stopTaskRunnerFactory.execute(new Runnable() { @Override public void run() {
taskRunner.execute(new Runnable() { @Override public void run() {
LOG.debug("The local Exception was: {}", error, error); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
for (final ActiveMQDestination destination : matchingDestinations) { if (concurrent.getCount() > 0) { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
@Override public void onAccept(final Transport transport) { try { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { try { if (!brokerService.isStopping()) { Connection connection = createConnection(transport); connection.start(); } else { throw new BrokerStoppedException("Broker " + brokerService + " is being stopped"); } } catch (Exception e) { String remoteHost = transport.getRemoteAddress(); ServiceSupport.dispose(transport); onAcceptError(e, remoteHost); } } }); } catch (Exception e) { String remoteHost = transport.getRemoteAddress(); ServiceSupport.dispose(transport); onAcceptError(e, remoteHost); } }
final CountDownLatch sendShutdown = new CountDownLatch(1); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
private void ackAdvisory(Message message) throws IOException { demandConsumerDispatched++; if (demandConsumerDispatched > (demandConsumerInfo.getPrefetchSize() * (configuration.getAdvisoryAckPercentage() / 100f))) { final MessageAck ack = new MessageAck(message, MessageAck.STANDARD_ACK_TYPE, demandConsumerDispatched); ack.setConsumerId(demandConsumerInfo.getConsumerId()); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { try { remoteBroker.oneway(ack); } catch (IOException e) { LOG.warn("Failed to send advisory ack " + ack, e); } } }); demandConsumerDispatched = 0; } }
protected void doInit() throws Exception { taskRunnerFactory.execute(new Runnable() { @Override public void run() { //Need to start in new thread to let startup finish first //We can trigger a read because we know the channel is ready since the SSL handshake //already happened serviceRead(); initialized.countDown(); } }); }
protected void doInit() throws Exception { taskRunnerFactory.execute(new Runnable() { @Override public void run() { //Need to start in new thread to let startup finish first //We can trigger a read because we know the channel is ready since the SSL handshake //already happened serviceRead(); initialized.countDown(); } }); }
protected void doInit() throws Exception { taskRunnerFactory.execute(new Runnable() { @Override public void run() { //Need to start in new thread to let startup finish first //We can trigger a read because we know the channel is ready since the SSL handshake //already happened serviceRead(); initialized.countDown(); } }); }