Package org.fusesource.hawtdispatch.internal.util

Examples of org.fusesource.hawtdispatch.internal.util.RunnableCountDownLatch


    @Ignore
  @Test()
  public void autoCreateBroker() throws Exception {
    Transport connect = TransportFactory.connect("vm://test1");
        connect.setDispatchQueue(Dispatch.createQueue());
        RunnableCountDownLatch cd = new RunnableCountDownLatch(1);
        connect.start(cd);
        cd.await();
    assertNotNull(connect);
        cd = new RunnableCountDownLatch(1);
    connect.stop(cd);
        cd.await();
  }
View Full Code Here


     * Stops the given service, catching any exceptions that are thrown.
     */
    public void stop(Service service) {
        try {
            if (service != null) {
                RunnableCountDownLatch latch = new RunnableCountDownLatch(1);
                service.stop(latch);
                latch.await();
            }
        } catch (Exception e) {
            onException(service, e);
        }
    }
View Full Code Here

    /**
     * Stops a list of services
     */
    public void stopServices(List<Service> services) throws Exception {
        RunnableCountDownLatch latch = new RunnableCountDownLatch(services.size());
        for (int i = 0; i < services.size(); i++) {
            Service service =  services.get(i);
            try {
                service.stop(latch);
            } catch (Exception e) {
                onException(service, e);
            }
        }
        if( firstException==null ) {
            latch.await();
        }
    }
View Full Code Here

    private AtomicBoolean stopped = new AtomicBoolean(false);
    private List<ServiceListener>serviceListeners = new CopyOnWriteArrayList<ServiceListener>();

    public static void dispose(Service service) {
        try {
            RunnableCountDownLatch latch = new RunnableCountDownLatch(1);
            service.stop(latch);
            latch.await();
        } catch (Exception e) {
            LOG.debug("Could not stop service: " + service + ". Reason: " + e, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.fusesource.hawtdispatch.internal.util.RunnableCountDownLatch

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.