@Override public void run() { synchronized (responseLock) { if (!this.expired && !isClosed()) { try { sendHeartbeat(); } catch (Throwable ex) { // Ignore: already handled in writeFrame... } finally { this.expired = true; } } } }
public final void sendMessage(WebSocketMessage<?> message) throws IOException { Assert.state(!isClosed(), "Cannot send a message when session is closed"); Assert.isInstanceOf(TextMessage.class, message, "SockJS supports text messages only"); sendMessageInternal(((TextMessage) message).getPayload()); }
/** * Invoked when the underlying connection is closed. */ public final void delegateConnectionClosed(CloseStatus status) throws Exception { if (!isClosed()) { try { updateLastActiveTime(); // Avoid cancelHeartbeat() and responseLock within server "close" callback ScheduledFuture<?> future = this.heartbeatFuture; if (future != null) { this.heartbeatFuture = null; future.cancel(false); } } finally { this.state = State.CLOSED; this.handler.afterConnectionClosed(this, status); } } }
public void delegateMessages(String... messages) throws SockJsMessageDeliveryException { List<String> undelivered = new ArrayList<>(Arrays.asList(messages)); for (String message : messages) { try { if (isClosed()) { throw new SockJsMessageDeliveryException(this.id, undelivered, "Session closed"); } else { this.handler.handleMessage(this, new TextMessage(message)); undelivered.remove(0); } } catch (Throwable ex) { throw new SockJsMessageDeliveryException(this.id, undelivered, ex); } } }
private void assertState(boolean isNew, boolean isOpen, boolean isClosed) { assertEquals(isNew, this.session.isNew()); assertEquals(isOpen, this.session.isOpen()); assertEquals(isClosed, this.session.isClosed()); }
@Override public void run() { synchronized (responseLock) { if (!this.expired && !isClosed()) { try { sendHeartbeat(); } catch (Throwable ex) { // Ignore: already handled in writeFrame... } finally { this.expired = true; } } } }
@Override public void run() { synchronized (responseLock) { if (!this.expired && !isClosed()) { try { sendHeartbeat(); } catch (Throwable ex) { // Ignore: already handled in writeFrame... } finally { this.expired = true; } } } }
public final void sendMessage(WebSocketMessage<?> message) throws IOException { Assert.state(!isClosed(), "Cannot send a message when session is closed"); Assert.isInstanceOf(TextMessage.class, message, "SockJS supports text messages only"); sendMessageInternal(((TextMessage) message).getPayload()); }
public final void sendMessage(WebSocketMessage<?> message) throws IOException { Assert.state(!isClosed(), "Cannot send a message when session is closed"); Assert.isInstanceOf(TextMessage.class, message, "SockJS supports text messages only"); sendMessageInternal(((TextMessage) message).getPayload()); }
/** * Invoked when the underlying connection is closed. */ public final void delegateConnectionClosed(CloseStatus status) throws Exception { if (!isClosed()) { try { updateLastActiveTime(); // Avoid cancelHeartbeat() and responseLock within server "close" callback ScheduledFuture<?> future = this.heartbeatFuture; if (future != null) { this.heartbeatFuture = null; future.cancel(false); } } finally { this.state = State.CLOSED; this.handler.afterConnectionClosed(this, status); } } }
/** * Invoked when the underlying connection is closed. */ public final void delegateConnectionClosed(CloseStatus status) throws Exception { if (!isClosed()) { try { updateLastActiveTime(); // Avoid cancelHeartbeat() and responseLock within server "close" callback ScheduledFuture<?> future = this.heartbeatFuture; if (future != null) { this.heartbeatFuture = null; future.cancel(false); } } finally { this.state = State.CLOSED; this.handler.afterConnectionClosed(this, status); } } }
public void delegateMessages(String... messages) throws SockJsMessageDeliveryException { List<String> undelivered = new ArrayList<>(Arrays.asList(messages)); for (String message : messages) { try { if (isClosed()) { throw new SockJsMessageDeliveryException(this.id, undelivered, "Session closed"); } else { this.handler.handleMessage(this, new TextMessage(message)); undelivered.remove(0); } } catch (Throwable ex) { throw new SockJsMessageDeliveryException(this.id, undelivered, ex); } } }
public void delegateMessages(String... messages) throws SockJsMessageDeliveryException { List<String> undelivered = new ArrayList<>(Arrays.asList(messages)); for (String message : messages) { try { if (isClosed()) { throw new SockJsMessageDeliveryException(this.id, undelivered, "Session closed"); } else { this.handler.handleMessage(this, new TextMessage(message)); undelivered.remove(0); } } catch (Throwable ex) { throw new SockJsMessageDeliveryException(this.id, undelivered, ex); } } }