Example usage for org.springframework.web.socket.sockjs SockJsTransportFailureException SockJsTransportFailureException

List of usage examples for org.springframework.web.socket.sockjs SockJsTransportFailureException SockJsTransportFailureException

Introduction

In this page you can find the example usage for org.springframework.web.socket.sockjs SockJsTransportFailureException SockJsTransportFailureException.

Prototype

public SockJsTransportFailureException(String message, String sessionId, @Nullable Throwable cause) 

Source Link

Document

Constructor for SockJsTransportFailureException.

Usage

From source file:org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.java

/**
 * For internal use within a TransportHandler and the (TransportHandler-specific)
 * session class./*w  w w .  j  a  v  a 2  s  .c o m*/
 */
protected void writeFrame(SockJsFrame frame) throws SockJsTransportFailureException {
    if (logger.isTraceEnabled()) {
        logger.trace("Preparing to write " + frame);
    }
    try {
        writeFrameInternal(frame);
    } catch (Throwable ex) {
        logWriteFrameFailure(ex);
        try {
            // Force disconnect (so we won't try to send close frame)
            disconnect(CloseStatus.SERVER_ERROR);
        } catch (Throwable disconnectFailure) {
            // Ignore
        }
        try {
            close(CloseStatus.SERVER_ERROR);
        } catch (Throwable closeFailure) {
            // Nothing of consequence, already forced disconnect
        }
        throw new SockJsTransportFailureException("Failed to write " + frame, getId(), ex);
    }
}