Examples of TransportListener


Examples of org.apache.activemq.transport.TransportListener

        dispatch(peer, peer.messageQueue, command);
    }

    public void dispatch(VMTransport transport, BlockingQueue<Object> pending, Object command) {
        TransportListener transportListener = transport.getTransportListener();
        if (transportListener != null) {
            synchronized (started) {

                // Ensure that no additional commands entered the queue in the small time window
                // before the start method locks the dispatch lock and the oneway method was in
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

    /**
     * @see org.apache.activemq.thread.Task#iterate()
     */
    public boolean iterate() {

        final TransportListener tl = transportListener;

        LinkedBlockingQueue<Object> mq;
        try {
            mq = getMessageQueue();
        } catch (TransportDisposedIOException e) {
            return false;
        }

        Object command = mq.poll();
        if (command != null && !disposed.get()) {
            if( command == DISCONNECT ) {
                tl.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed."));
            } else {
                tl.onCommand(command);
            }
            return !mq.isEmpty() && !disposed.get();
        } else {
            if(disposed.get()) {
                mq.clear();
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

    public ConnectionPool(ActiveMQConnection connection, ObjectPoolFactory poolFactory) {
        this(connection, new ConcurrentHashMap<SessionKey, SessionPool>(), poolFactory);
        // Add a transport Listener so that we can notice if this connection
        // should be expired due to a connection failure.
        connection.addTransportListener(new TransportListener() {
            public void onCommand(Object command) {
            }

            public void onException(IOException error) {
                synchronized (ConnectionPool.this) {
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

    public void testReconnectUnlimited() throws Exception {

        Transport transport = TransportFactory.connect(
                new URI("failover://(tcp://0.0.0.0:61616)?useExponentialBackOff=false&reconnectDelay=0&initialReconnectDelay=0"));

        transport.setTransportListener(new TransportListener() {

            public void onCommand(Object command) {
                commandsReceived++;
            }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

  }

    protected Transport createTransport() throws Exception {
      Transport transport = TransportFactory.connect(
          new URI("failover://(tcp://localhost:1234)"));
        transport.setTransportListener(new TransportListener() {

            public void onCommand(Object command) {
              commandsReceived++;
            }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

                onClientInternalException(e);
            }

        }
        for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) {
            TransportListener listener = iter.next();
            listener.onCommand(command);
        }
    }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

                    } catch (JMSException e) {
                        LOG.warn("Exception during connection cleanup, " + e, e);
                    }
                    for (Iterator<TransportListener> iter = transportListeners
                            .iterator(); iter.hasNext();) {
                        TransportListener listener = iter.next();
                        listener.onException(error);
                    }
                }
            });
        }
    }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

        for (ActiveMQConnectionConsumer connectionConsumer : this.connectionConsumers) {
            connectionConsumer.clearMessagesInProgress();
        }

        for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) {
            TransportListener listener = iter.next();
            listener.transportInterupted();
        }
    }
View Full Code Here

Examples of org.apache.activemq.transport.TransportListener

        }
    }

    public void transportResumed() {
        for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) {
            TransportListener listener = iter.next();
            listener.transportResumed();
        }
    }
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.