gpt4 book ai didi

org.apache.tomcat.websocket.WsSession.doClose()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 19:29:05 41 4
gpt4 key购买 nike

本文整理了Java中org.apache.tomcat.websocket.WsSession.doClose()方法的一些代码示例,展示了WsSession.doClose()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WsSession.doClose()方法的具体详情如下:
包路径:org.apache.tomcat.websocket.WsSession
类名称:WsSession
方法名:doClose

WsSession.doClose介绍

[英]WebSocket 1.0. Section 2.1.5. Need internal close method as spec requires that the local endpoint receives a 1006 on timeout.
[中]WebSocket 1.0。第2.1.5节。需要内部关闭方法,因为规范要求本地端点在超时时接收1006。

代码示例

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public void close(CloseReason closeReason) throws IOException {
  doClose(closeReason, closeReason);
}

代码示例来源:origin: org.jboss.web/jbossweb

@Override
public void close(CloseReason closeReason) throws IOException {
  doClose(closeReason, closeReason);
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

@Override
public void close(CloseReason closeReason) throws IOException {
  doClose(closeReason, closeReason);
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

@Override
public void close(CloseReason closeReason) throws IOException {
  doClose(closeReason, closeReason);
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

@Override
public void close(CloseReason closeReason) throws IOException {
  doClose(closeReason, closeReason);
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

private void onError(Throwable throwable) {
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, throwable.getMessage()),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, throwable.getMessage()));
  // Need to call onError using the web application's class loader
  Thread t = Thread.currentThread();
  ClassLoader cl = t.getContextClassLoader();
  t.setContextClassLoader(applicationClassLoader);
  try {
    ep.onError(wsSession, throwable);
  } finally {
    t.setContextClassLoader(cl);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

private void handleSendFailureWithEncode(Throwable t) throws IOException, EncodeException {
  // First, unwrap any execution exception
  if (t instanceof ExecutionException) {
    t = t.getCause();
  }
  // Close the session
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, t.getMessage()),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()));
  // Rethrow the exception
  if (t instanceof EncodeException) {
    throw (EncodeException) t;
  }
  if (t instanceof IOException) {
    throw (IOException) t;
  }
  throw new IOException(t);
}

代码示例来源:origin: codefollower/Tomcat-Research

protected void checkExpiration() {
  long timeout = maxIdleTimeout;
  if (timeout < 1) {
    return;
  }
  if (System.currentTimeMillis() - lastActive > timeout) {
    String msg = sm.getString("wsSession.timeout");
    doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

protected void checkExpiration() {
  long timeout = maxIdleTimeout;
  if (timeout < 1) {
    return;
  }
  if (System.currentTimeMillis() - lastActive > timeout) {
    String msg = sm.getString("wsSession.timeout");
    doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

protected void checkExpiration() {
  long timeout = maxIdleTimeout;
  if (timeout < 1) {
    return;
  }
  if (System.currentTimeMillis() - lastActive > timeout) {
    String msg = MESSAGES.sessionTimeout();
    doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  }
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

protected void checkExpiration() {
  long timeout = maxIdleTimeout;
  if (timeout < 1) {
    return;
  }
  if (System.currentTimeMillis() - lastActive > timeout) {
    String msg = sm.getString("wsSession.timeout", getId());
    if (log.isDebugEnabled()) {
      log.debug(msg);
    }
    doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

protected void checkExpiration() {
  long timeout = maxIdleTimeout;
  if (timeout < 1) {
    return;
  }
  if (System.currentTimeMillis() - lastActive > timeout) {
    String msg = sm.getString("wsSession.timeout", getId());
    if (log.isDebugEnabled()) {
      log.debug(msg);
    }
    doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  }
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

if (!messagePartInProgress.tryAcquire(timeout, TimeUnit.MILLISECONDS)) {
  String msg = sm.getString("wsRemoteEndpoint.acquireTimeout");
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  throw new SocketTimeoutException(msg);
wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
    new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
throw new IOException(msg, e);
  messagePartInProgress.release();
  Throwable t = bsh.getSendResult().getException();
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, t.getMessage()),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()));
  throw new IOException (t);

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

if (!messagePartInProgress.tryAcquire(timeout, TimeUnit.MILLISECONDS)) {
  String msg = sm.getString("wsRemoteEndpoint.acquireTimeout");
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
  throw new SocketTimeoutException(msg);
wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
    new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
throw new IOException(msg, e);
  messagePartInProgress.release();
  Throwable t = bsh.getSendResult().getException();
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, t.getMessage()),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()));
  throw new IOException (t);

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

case ERROR:
  String msg = sm.getString("wsHttpUpgradeHandler.closeOnError");
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));

代码示例来源:origin: Red5/red5-plugins

case ERROR:
  String msg = sm.getString("wsHttpUpgradeHandler.closeOnError");
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg), new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

case ERROR:
  String msg = sm.getString("wsHttpUpgradeHandler.closeOnError");
  wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
      new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com