Search in sources :

Example 6 with StompFrame

use of org.codehaus.stomp.StompFrame in project narayana by jbosstm.

the class TcpTransport method run.

/**
 * reads packets from a Socket
 */
public void run() {
    log.trace("StompConnect TCP consumer thread starting");
    while (!stopped.get()) {
        try {
            StompFrame frame = marshaller.unmarshal(dataIn);
            log.debug("Sending stomp frame");
            try {
                inputHandler.onStompFrame(frame);
            } catch (IOException e) {
                if (frame.getAction().equals(Stomp.Responses.ERROR)) {
                    log.warn("Could not send frame to client: " + new String(frame.getContent()));
                }
                throw e;
            }
        } catch (Throwable e) {
            // no need to log EOF exceptions
            if (e instanceof EOFException) {
                // Happens when the remote side disconnects
                log.debug("Caught an EOFException: " + e.getMessage(), e);
            } else {
                log.fatal("Caught an exception: " + e.getMessage(), e);
            }
            try {
                stop();
            } catch (Exception e2) {
                log.warn("Caught while closing: " + e2 + ". Now Closed", e2);
            }
        }
    }
}
Also used : StompFrame(org.codehaus.stomp.StompFrame) EOFException(java.io.EOFException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) EOFException(java.io.EOFException) JMSException(javax.jms.JMSException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProtocolException(org.codehaus.stomp.ProtocolException)

Aggregations

StompFrame (org.codehaus.stomp.StompFrame)6 HashMap (java.util.HashMap)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ProtocolException (org.codehaus.stomp.ProtocolException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1 Map (java.util.Map)1 BytesMessage (javax.jms.BytesMessage)1 Connection (javax.jms.Connection)1 JMSException (javax.jms.JMSException)1 Message (javax.jms.Message)1 Session (javax.jms.Session)1 TextMessage (javax.jms.TextMessage)1 XAConnection (javax.jms.XAConnection)1 InboundBridge (org.jboss.narayana.rest.bridge.inbound.InboundBridge)1