Examples of TransportListener


Examples of org.apache.activemq.transport.TransportListener

        }
    }

    public void transportResumed() {
        for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) {
            TransportListener listener = iter.next();
            listener.transportResumed();
        }
        for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) {
            ActiveMQSession s = i.next();
            s.deliverAcks();
        }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

    }

    protected void doStart() throws Exception {
        LOG.info("Starting " + this);

        configuredTransport.setTransportListener(new TransportListener() {
            public void onCommand(Object o) {
                final Command command = (Command)o;
                processInboundConnection(command);
            }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

            onException(IOExceptionSupport.create(e));
        }
    }

    public void sendToActiveMQ(Command command) {
        TransportListener l = transportListener;
        if (l!=null) {
            l.onCommand(command);
        }
    }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

        }, "ActiveMQ Failover Worker: " + System.identityHashCode(this));
    }

    TransportListener createTransportListener() {
        return new TransportListener() {
            public void onCommand(Object o) {
                Command command = (Command)o;
                if (command == null) {
                    return;
                }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

        if (peer == null) {
            throw new IOException("Peer not connected.");
        }

       
        TransportListener transportListener=null;
        try {
            // Disable the peer from changing his state while we try to enqueue onto him.
            peer.enqueueValve.increment();
       
            if (peer.disposed || peer.stopping.get()) {
                throw new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed.");
            }
           
            if (peer.started) {
                if (peer.async) {
                    peer.getMessageQueue().put(command);
                    peer.wakeup();
                } else {
                    transportListener = peer.transportListener;
                }
                enqueueValve.decrement();
            } else {
                peer.getMessageQueue().put(command);
            }
           
        } catch (InterruptedException e) {
            throw IOExceptionSupport.create(e);
        } finally {
            // Allow the peer to change state again...
            peer.enqueueValve.decrement();
        }

        if( transportListener!=null ) {
            if( command == DISCONNECT ) {
                transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed."));
            } else {
                transportListener.onCommand(command);
            }
        }
    }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

    /**
     * @see org.apache.activemq.thread.Task#iterate()
     */
    public boolean iterate() {
       
        final TransportListener tl;
        try {
            // Disable changing the state variables while we are running...
            enqueueValve.increment();
            tl = transportListener;
            if (!started || disposed || tl == null || stopping.get()) {
                if( stopping.get() ) {
                    // drain the queue it since folks could be blocked putting on to
                    // it and that would not allow the stop() method for finishing up.
                    getMessageQueue().clear()
                }
                return false;
            }
        } catch (InterruptedException e) {
            return false;
        } finally {
            enqueueValve.decrement();
        }

        LinkedBlockingQueue<Object> mq = getMessageQueue();
        Object command = mq.poll();
        if (command != null) {
            if( command == DISCONNECT ) {
                tl.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed."));
            } else {
                tl.onCommand(command);
            }
            return !mq.isEmpty();
        } else {
            return false;
        }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

                public void onException(IOException error) {
                    serviceLocalException(error);
                }
            });
            remoteBroker.setTransportListener(new TransportListener() {

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

Examples of org.apache.activemq.transport.TransportListener

     * @throws Exception
     * @throws URISyntaxException
     */
    private void startClient(String uri) throws Exception, URISyntaxException {
        clientTransport = TransportFactory.connect(new URI(uri));
        clientTransport.setTransportListener(new TransportListener() {
            public void onCommand(Object command) {
                if (command instanceof WireFormatInfo) {
                    clientWF.set((WireFormatInfo)command);
                    negociationCounter.countDown();
                }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

        server.setAcceptListener(new TransportAcceptListener() {
            public void onAccept(Transport transport) {
                try {
                    LOG.info("[" + getName() + "] Server Accepted a Connection");
                    serverTransport = transport;
                    serverTransport.setTransportListener(new TransportListener() {
                        public void onCommand(Object command) {
                            if (command instanceof WireFormatInfo) {
                                serverWF.set((WireFormatInfo)command);
                                negociationCounter.countDown();
                            }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

            onException(IOExceptionSupport.create(e));
        }
    }

    public void sendToActiveMQ(Command command) {
        TransportListener l = transportListener;
        if (l != null) {
            l.onCommand(command);
        }
    }
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.