當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceStopper.throwFirstException方法代碼示例

本文整理匯總了Java中org.apache.activemq.util.ServiceStopper.throwFirstException方法的典型用法代碼示例。如果您正苦於以下問題:Java ServiceStopper.throwFirstException方法的具體用法?Java ServiceStopper.throwFirstException怎麽用?Java ServiceStopper.throwFirstException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.activemq.util.ServiceStopper的用法示例。


在下文中一共展示了ServiceStopper.throwFirstException方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
public void stop() throws Exception {
    try {
        if (connectionInfo != null) {
            localBroker.request(connectionInfo.createRemoveCommand());
            remoteBroker.request(connectionInfo.createRemoveCommand());
        }
        localBroker.setTransportListener(null);
        remoteBroker.setTransportListener(null);
        localBroker.oneway(new ShutdownInfo());
        remoteBroker.oneway(new ShutdownInfo());
    } finally {
        ServiceStopper ss = new ServiceStopper();
        ss.stop(localBroker);
        ss.stop(remoteBroker);
        ss.throwFirstException();
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:18,代碼來源:ForwardingBridge.java

示例2: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
@Override
public void stop() throws Exception {
    ServiceStopper ss = new ServiceStopper();
    if (discoveryAgent != null) {
        ss.stop(discoveryAgent);
    }
    if (server != null) {
        ss.stop(server);
    }
    if (this.statusDector != null) {
        this.statusDector.stop();
    }

    for (TransportConnection connection : connections) {
        ss.stop(connection);
    }
    server = null;
    ss.throwFirstException();
    LOG.info("Connector {} stopped", getName());
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:21,代碼來源:TransportConnector.java

示例3: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
public void stop() throws Exception {
    if (stopped.compareAndSet(false, true)) {
        stopping.set(true);
        ServiceStopper stopper = new ServiceStopper();
        try {
            doStop(stopper);
        } catch (Exception e) {
            stopper.onException(this, e);
        }
        stopped.set(true);
        started.set(false);
        stopping.set(false);
        stopper.throwFirstException();
    }

    CountDownLatch countDownLatch = stoppedLatch.get();
    if (countDownLatch != null && Thread.currentThread() != this.runnerThread) {
        countDownLatch.await(1, TimeUnit.SECONDS);
    }
}
 
開發者ID:apache,項目名稱:activemq-openwire,代碼行數:21,代碼來源:TcpTransport.java

示例4: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
public void stop() throws Exception {
    if (!running.compareAndSet(true, false)) {
        return;
    }
    shuttingDown.set(true);
    ServiceStopper ss = new ServiceStopper();
    ss.stop(localTransport);
    ss.stop(remoteTransport);
    ss.throwFirstException();
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:11,代碼來源:ProxyConnection.java

示例5: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
public void stop() throws Exception {
    ServiceStopper ss = new ServiceStopper();
    if (this.server != null) {
        ss.stop(this.server);
    }
    for (Iterator<ProxyConnection> iter = connections.iterator(); iter.hasNext();) {
        LOG.info("Connector stopped: Stopping proxy.");
        ss.stop(iter.next());
    }
    ss.throwFirstException();
    LOG.info("Proxy Connector {} stopped", getName());
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:13,代碼來源:ProxyConnector.java

示例6: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
@Override
public void stop() throws Exception {
    started = false;
    this.scheduler.cancel(purgeInactiveDestinationsTask);
    ServiceStopper ss = new ServiceStopper();
    doStop(ss);
    ss.throwFirstException();
    // clear the state
    clientIdSet.clear();
    connections.clear();
    destinations.clear();
    brokerInfos.clear();
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:14,代碼來源:RegionBroker.java

示例7: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
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();
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:28,代碼來源:FanoutTransport.java

示例8: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
@Override
public void stop() throws Exception {
    ServiceStopper ss = new ServiceStopper();
    ss.stop(discoveryAgent);
    ss.stop(next);
    ss.throwFirstException();
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:8,代碼來源:DiscoveryTransport.java

示例9: stop

import org.apache.activemq.util.ServiceStopper; //導入方法依賴的package包/類
@Override
public void stop() throws Exception {
    if (started.compareAndSet(true, false)) {
        if (disposed.compareAndSet(false, true)) {
            LOG.debug(" stopping {} bridge to {}", configuration.getBrokerName(), remoteBrokerName);

            futureRemoteBrokerInfo.cancel(true);
            futureLocalBrokerInfo.cancel(true);

            NetworkBridgeListener l = this.networkBridgeListener;
            if (l != null) {
                l.onStop(this);
            }
            try {
                // local start complete
                if (startedLatch.getCount() < 2) {
                    LOG.trace("{} unregister bridge ({}) to {}", new Object[]{
                            configuration.getBrokerName(), this, remoteBrokerName
                    });
                    brokerService.getBroker().removeBroker(null, remoteBrokerInfo);
                    brokerService.getBroker().networkBridgeStopped(remoteBrokerInfo);
                }

                remoteBridgeStarted.set(false);
                final CountDownLatch sendShutdown = new CountDownLatch(1);

                brokerService.getTaskRunnerFactory().execute(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            serialExecutor.shutdown();
                            if (!serialExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
                                List<Runnable> pendingTasks = serialExecutor.shutdownNow();
                                    LOG.info("pending tasks on stop {}", pendingTasks);
                            }
                            localBroker.oneway(new ShutdownInfo());
                            remoteBroker.oneway(new ShutdownInfo());
                        } catch (Throwable e) {
                            LOG.debug("Caught exception sending shutdown", e);
                        } finally {
                            sendShutdown.countDown();
                        }

                    }
                }, "ActiveMQ ForwardingBridge StopTask");

                if (!sendShutdown.await(10, TimeUnit.SECONDS)) {
                    LOG.info("Network Could not shutdown in a timely manner");
                }
            } finally {
                ServiceStopper ss = new ServiceStopper();
                ss.stop(remoteBroker);
                ss.stop(localBroker);
                ss.stop(duplexInboundLocalBroker);
                // Release the started Latch since another thread could be
                // stuck waiting for it to start up.
                startedLatch.countDown();
                startedLatch.countDown();
                localStartedLatch.countDown();

                ss.throwFirstException();
            }
        }

        LOG.info("{} bridge to {} stopped", configuration.getBrokerName(), remoteBrokerName);
    }
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:68,代碼來源:DemandForwardingBridgeSupport.java


注:本文中的org.apache.activemq.util.ServiceStopper.throwFirstException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。