Package org.fusesource.hawtdispatch

Examples of org.fusesource.hawtdispatch.Task


            }
        });
        final String address = server.getBoundAddress();

        // Start a client..
        queue.execute(new Task() {
            public void run() {
                try {
                    System.out.println("Creating a client connection.");
                    AmqpConnection c = startClient(address);
                    Session session = c.getProtonConnection().session();
View Full Code Here


        servers.clear();
    }

    private void start(TransportServer transport) throws Exception {
        final CountDownLatch done = new CountDownLatch(1);
        transport.start(new Task() {
            @Override
            public void run() {
                done.countDown();
            }
        });
View Full Code Here

        });
        done.await();
    }
    private void stop(TransportServer transport) throws Exception {
        final CountDownLatch done = new CountDownLatch(1);
        transport.stop(new Task() {
            @Override
            public void run() {
                done.countDown();
            }
        });
View Full Code Here

        done.await();
    }

    private void start(AmqpConnection transport) throws Exception {
        final CountDownLatch done = new CountDownLatch(1);
        transport.start(new Task() {
            @Override
            public void run() {
                done.countDown();
            }
        });
View Full Code Here

        });
        done.await();
    }
    private void stop(AmqpConnection transport) throws Exception {
        final CountDownLatch done = new CountDownLatch(1);
        transport.stop(new Task() {
            @Override
            public void run() {
                done.countDown();
            }
        });
View Full Code Here


    protected State _serviceState = CREATED;

    final public void start(final Task onCompleted) {
        getDispatchQueue().execute(new Task() {
            public void run() {
                if (_serviceState == CREATED ||
                        _serviceState == STOPPED) {
                    final STARTING state = new STARTING();
                    state.add(onCompleted);
                    _serviceState = state;
                    _start(new Task() {
                        public void run() {
                            _serviceState = STARTED;
                            state.done();
                        }
                    });
View Full Code Here

            }
        });
    }

    final public void stop(final Task onCompleted) {
        getDispatchQueue().execute(new Task() {
            public void run() {
                if (_serviceState == STARTED) {
                    final STOPPING state = new STOPPING();
                    state.add(onCompleted);
                    _serviceState = state;
                    _stop(new Task() {
                        public void run() {
                            _serviceState = STOPPED;
                            state.done();
                        }
                    });
View Full Code Here

            }
        }
    }

    static public void attach(final VirtualHost host, final UTF8Buffer client_id, final MqttProtocolHandler handler) {
        queue.execute(new Task() {
            @Override
            public void run() {
                final HostState host_state = host.plugin_state(
                        Scala2Java.toScala(new Fn0<HostState>(){
                            @Override
                            public HostState apply() {
                                return new HostState(host);
                            }
                        }),
                        HostState.class);
                host_state.on_load(new Task() {
                    @Override
                    public void run() {
                        MqttSession assignment = host_state.sessions.get(client_id);
                        if (assignment != null) {
                            assignment.connect(handler);
View Full Code Here

            }
        });
    }

    static public void disconnect(final HostState host_state, final UTF8Buffer client_id, final MqttProtocolHandler handler) {
        queue.execute(new Task() {
            @Override
            public void run() {
                MqttSession assignment = host_state.sessions.get(client_id);
                if (assignment != null) {
                    assignment.disconnect(handler);
View Full Code Here

            }
        });
    }

    static public void remove(final HostState host_state, final UTF8Buffer client_id) {
        queue.execute(new Task() {
            @Override
            public void run() {
                host_state.sessions.remove(client_id);
            }
        });
View Full Code Here

TOP

Related Classes of org.fusesource.hawtdispatch.Task

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.