Package org.apache.activemq.util

Examples of org.apache.activemq.util.ServiceStopper


        LOG.info("Proxy Connector " + getName() + " Started");

    }

    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 " + getName() + " Stopped");
    }
View Full Code Here


            remoteBroker.oneway(new ShutdownInfo());
            localBroker.oneway(new ShutdownInfo());
        } catch (IOException e) {
            LOG.debug("Caught exception stopping", e);
        } finally {
            ServiceStopper ss = new ServiceStopper();
            ss.stop(localBroker);
            ss.stop(remoteBroker);
            ss.throwFirstException();
        }
    }
View Full Code Here

        if (!started.compareAndSet(true, false)) {
            return;
        }
        LOG.info("ActiveMQ Message Broker (" + getBrokerName() + ", " + brokerId + ") is shutting down");
        removeShutdownHook();
        ServiceStopper stopper = new ServiceStopper();
        if (services != null) {
            for (Service service: services) {
                stopper.stop(service);
            }
        }
        stopAllConnectors(stopper);
        stopper.stop(persistenceAdapter);
        if (broker != null) {
            stopper.stop(broker);
        }
        if (tempDataStore != null) {
            tempDataStore.close();
        }
        if (isUseJmx()) {
            MBeanServer mbeanServer = getManagementContext().getMBeanServer();
            if (mbeanServer != null) {
                for (Iterator<ObjectName> iter = registeredMBeanNames.iterator(); iter.hasNext();) {
                    ObjectName name = iter.next();
                    try {
                        mbeanServer.unregisterMBean(name);
                    } catch (Exception e) {
                        stopper.onException(mbeanServer, e);
                    }
                }
            }
            stopper.stop(getManagementContext());
        }
        // remove any VMTransports connected
        // this has to be done after services are stopped,
        // to avoid timimg issue with discovery (spinning up a new instance)
        BrokerRegistry.getInstance().unbind(getBrokerName());
        VMTransportFactory.stopped(getBrokerName());
        stopped.set(true);
        stoppedLatch.countDown();
        LOG.info("ActiveMQ JMS Message Broker (" + getBrokerName() + ", " + brokerId + ") stopped");
        stopper.throwFirstException();
    }
View Full Code Here

        tempTopicRegion.start();
    }

    public void stop() throws Exception {
        started = false;
        ServiceStopper ss = new ServiceStopper();
        doStop(ss);
        ss.throwFirstException();
    }
View Full Code Here

                    localBroker.oneway(new ShutdownInfo());
                    remoteBroker.oneway(new ShutdownInfo());
                } catch (IOException e) {
                    LOG.debug("Caught exception stopping", e);
                } finally {
                    ServiceStopper ss = new ServiceStopper();
                    ss.stop(localBroker);
                    ss.stop(remoteBroker);
                    // Release the started Latch since another thread could be
                    // stuck waiting for it to start up.
                    startedLatch.countDown();
                    startedLatch.countDown();
                    localStartedLatch.countDown();
                    ss.throwFirstException();
                }
            }
            if (wasDisposedAlready) {
                LOG.debug(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped");
            } else {
View Full Code Here

        LOG.info("Connector " + getName() + " Started");
    }

    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 (Iterator<TransportConnection> iter = connections.iterator(); iter.hasNext();) {
            TransportConnection c = iter.next();
            ss.stop(c);
        }
        ss.throwFirstException();
        LOG.info("Connector " + getName() + " Stopped");
    }
View Full Code Here

        }
    }

    public void stop() throws Exception {
        synchronized (reconnectMutex) {
            ServiceStopper ss = new ServiceStopper();

            if (!started) {
                return;
            }
            started = false;
            disposed = true;

            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();
        }
        reconnectTask.shutdown();
    }
View Full Code Here

        consumer = session.createConsumer(destination);
        consumer.setMessageListener(listener);
    }

    public void stop() throws Exception {
        ServiceStopper stopper = new ServiceStopper();
        if (consumer != null) {
            try {
                consumer.close();
                consumer = null;
            } catch (JMSException e) {
                stopper.onException(this, e);
            }
        }
        if (session != null) {
            try {
                session.close();
                session = null;
            } catch (JMSException e) {
                stopper.onException(this, e);
            }
        }
        if (connection != null) {
            try {
                connection.close();
                connection = null;
            } catch (JMSException e) {
                stopper.onException(this, e);
            }
        }
        stopper.throwFirstException();
    }
View Full Code Here

    @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();
View Full Code Here

                    });
                    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);
                    // 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(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped");
            remoteBrokerNameKnownLatch.countDown();
        }
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.ServiceStopper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.