Examples of DefaultTransportListener


Examples of org.apache.activemq.transport.DefaultTransportListener

        }
        localBroker = TransportFactory.connect(localURI);
        remoteBroker = TransportFactory.connect(remoteURI);
        log.info("Starting a network connection between " + localBroker + " and " + remoteBroker + " has been established.");

        localBroker.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
            }

            public void onException(IOException error) {
                if (started.get()) {
                    serviceLocalException(error);
                }
            }
        });

        remoteBroker.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object o) {
              Command command = (Command) o;
                if (started.get()) {
                    serviceRemoteCommand(command);
                }
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

    public void start() throws Exception {
        if( !running.compareAndSet(false, true) ) {
            return;           
        }
           
        this.localTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                boolean shutdown=false;
                if( command.getClass() == ShutdownInfo.class ) {
                    shuttingDown.set(true);
                    shutdown=true;
                }
                try {
                    remoteTransport.oneway(command);
                    if( shutdown )
                        stop();
                } catch (IOException error) {
                    onFailure(error);
                } catch (Exception error) {
                    onFailure(IOExceptionSupport.create(error));
                }
            }
            public void onException(IOException error) {
                onFailure(error);
            }
        });
       
        this.remoteTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                try {
                    localTransport.oneway(command);
                } catch (IOException error) {
                    onFailure(error);
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

        if (connector != null) {
            this.statistics.setParent(connector.getStatistics());
        }
        this.taskRunnerFactory = taskRunnerFactory;
        this.transport = transport;
        this.transport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object o) {
                serviceLock.readLock().lock();
                try {
                    if (!(o instanceof Command)) {
                        throw new RuntimeException("Protocol violation - Command corrupted: " + o.toString());
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

        serviceRemoteCommand(remoteBrokerInfo);
    }

    public void start() throws Exception {
        if (started.compareAndSet(false, true)) {
            localBroker.setTransportListener(new DefaultTransportListener() {

                public void onCommand(Object o) {
                    Command command = (Command)o;
                    serviceLocalCommand(command);
                }
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

            this.messageAuthorizationPolicy = connector.getMessageAuthorizationPolicy();
        }
        this.taskRunnerFactory = taskRunnerFactory;
        this.stopTaskRunnerFactory = stopTaskRunnerFactory;
        this.transport = transport;
        this.transport.setTransportListener(new DefaultTransportListener() {
            @Override
            public void onCommand(Object o) {
                serviceLock.readLock().lock();
                try {
                    if (!(o instanceof Command)) {
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

    public void start() throws Exception {
        if (!running.compareAndSet(false, true)) {
            return;
        }

        this.localTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                boolean shutdown = false;
                if (command.getClass() == ShutdownInfo.class) {
                    shuttingDown.set(true);
                    shutdown = true;
                }
                // skipping WireFormat infos
                if (command.getClass() == WireFormatInfo.class) {
                    return;
                }
                try {
                    remoteTransport.oneway(command);
                    if (shutdown) {
                        stop();
                    }
                } catch (IOException error) {
                    onFailure(error);
                } catch (Exception error) {
                    onFailure(IOExceptionSupport.create(error));
                }
            }

            public void onException(IOException error) {
                onFailure(error);
            }
        });

        this.remoteTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                try {
                    // skipping WireFormat infos
                    if (command.getClass() == WireFormatInfo.class) {
                        return;
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

                throw new IllegalArgumentException("BrokerService is null on " + this);
            }

            if (isDuplex()) {
                duplexInboundLocalBroker = NetworkBridgeFactory.createLocalTransport(brokerService.getBroker());
                duplexInboundLocalBroker.setTransportListener(new DefaultTransportListener() {

                    @Override
                    public void onCommand(Object o) {
                        Command command = (Command) o;
                        serviceLocalCommand(command);
                    }

                    @Override
                    public void onException(IOException error) {
                        serviceLocalException(error);
                    }
                });
                duplexInboundLocalBroker.start();
            }

            localBroker.setTransportListener(new DefaultTransportListener() {

                @Override
                public void onCommand(Object o) {
                    Command command = (Command) o;
                    serviceLocalCommand(command);
                }

                @Override
                public void onException(IOException error) {
                    if (!futureLocalBrokerInfo.isDone()) {
                        futureLocalBrokerInfo.cancel(true);
                        return;
                    }
                    serviceLocalException(error);
                }
            });

            remoteBroker.setTransportListener(new DefaultTransportListener() {

                @Override
                public void onCommand(Object o) {
                    Command command = (Command) o;
                    serviceRemoteCommand(command);
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

    public void start() throws Exception {
        LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker
                 + " has been established.");

        localBroker.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object o) {
                Command command = (Command)o;
                serviceLocalCommand(command);
            }

            public void onException(IOException error) {
                serviceLocalException(error);
            }
        });

        remoteBroker.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object o) {
                Command command = (Command)o;
                serviceRemoteCommand(command);
            }
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

                throw new IllegalArgumentException("BrokerService is null on " + this);
            }

            if (isDuplex()) {
                duplexInboundLocalBroker = NetworkBridgeFactory.createLocalTransport(brokerService.getBroker());
                duplexInboundLocalBroker.setTransportListener(new DefaultTransportListener() {

                    @Override
                    public void onCommand(Object o) {
                        Command command = (Command) o;
                        serviceLocalCommand(command);
                    }

                    @Override
                    public void onException(IOException error) {
                        serviceLocalException(error);
                    }
                });
                duplexInboundLocalBroker.start();
            }

            localBroker.setTransportListener(new DefaultTransportListener() {

                @Override
                public void onCommand(Object o) {
                    Command command = (Command) o;
                    serviceLocalCommand(command);
                }

                @Override
                public void onException(IOException error) {
                    if (!futureLocalBrokerInfo.isDone()) {
                        futureLocalBrokerInfo.cancel(true);
                        return;
                    }
                    serviceLocalException(error);
                }
            });

            remoteBroker.setTransportListener(new DefaultTransportListener() {

                @Override
                public void onCommand(Object o) {
                    Command command = (Command) o;
                    serviceRemoteCommand(command);
View Full Code Here

Examples of org.apache.activemq.transport.DefaultTransportListener

    public void start() throws Exception {
        if (!running.compareAndSet(false, true)) {
            return;
        }

        this.localTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                boolean shutdown = false;
                if (command.getClass() == ShutdownInfo.class) {
                    shuttingDown.set(true);
                    shutdown = true;
                }
                // skipping WireFormat infos
                if (command.getClass() == WireFormatInfo.class) {
                    return;
                }
                try {
                    remoteTransport.oneway(command);
                    if (shutdown) {
                        stop();
                    }
                } catch (IOException error) {
                    onFailure(error);
                } catch (Exception error) {
                    onFailure(IOExceptionSupport.create(error));
                }
            }

            public void onException(IOException error) {
                onFailure(error);
            }
        });

        this.remoteTransport.setTransportListener(new DefaultTransportListener() {
            public void onCommand(Object command) {
                try {
                    // skipping WireFormat infos
                    if (command.getClass() == WireFormatInfo.class) {
                        return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.