gpt4 book ai didi

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

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

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

WsSession.updateLastActive介绍

暂无

代码示例

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

void endMessage(SendHandler handler, SendResult result) {
  synchronized (messagePartLock) {
    fragmented = nextFragmented;
    text = nextText;
    MessagePart mpNext = messagePartQueue.poll();
    if (mpNext == null) {
      messagePartInProgress = false;
    } else if (!closed){
      // Session may have been closed unexpectedly in the middle of
      // sending a fragmented message closing the endpoint. If this
      // happens, clearly there is no point trying to send the rest of
      // the message.
      writeMessagePart(mpNext);
    }
  }
  wsSession.updateLastActive();
  handler.onResult(result);
}

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

void endMessage(SendHandler handler, SendResult result) {
  boolean doWrite = false;
  MessagePart mpNext = null;
  synchronized (messagePartLock) {
    fragmented = nextFragmented;
    text = nextText;
    mpNext = messagePartQueue.poll();
    if (mpNext == null) {
      messagePartInProgress.release();
    } else if (!closed){
      // Session may have been closed unexpectedly in the middle of
      // sending a fragmented message closing the endpoint. If this
      // happens, clearly there is no point trying to send the rest of
      // the message.
      doWrite = true;
    }
  }
  if (doWrite) {
    // Actual write has to be outside sync block to avoid possible
    // deadlock between messagePartLock and writeLock in
    // o.a.coyote.http11.upgrade.AbstractServletOutputStream
    writeMessagePart(mpNext);
  }
  wsSession.updateLastActive();
  // Some handlers, such as the IntermediateMessageHandler, do not have a
  // nested handler so handler may be null.
  if (handler != null) {
    handler.onResult(result);
  }
}

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

void endMessage(SendHandler handler, SendResult result) {
  boolean doWrite = false;
  MessagePart mpNext = null;
  synchronized (messagePartLock) {
    fragmented = nextFragmented;
    text = nextText;
    mpNext = messagePartQueue.poll();
    if (mpNext == null) {
      messagePartInProgress.release();
    } else if (!closed){
      // Session may have been closed unexpectedly in the middle of
      // sending a fragmented message closing the endpoint. If this
      // happens, clearly there is no point trying to send the rest of
      // the message.
      doWrite = true;
    }
  }
  if (doWrite) {
    // Actual write has to be outside sync block to avoid possible
    // deadlock between messagePartLock and writeLock in
    // o.a.coyote.http11.upgrade.AbstractServletOutputStream
    writeMessagePart(mpNext);
  }
  wsSession.updateLastActive();
  // Some handlers, such as the IntermediateMessageHandler, do not have a
  // nested handler so handler may be null.
  if (handler != null) {
    handler.onResult(result);
  }
}

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

void endMessage(SendHandler handler, SendResult result) {
  boolean doWrite = false;
  MessagePart mpNext = null;
  synchronized (messagePartLock) {
    fragmented = nextFragmented;
    text = nextText;
    mpNext = messagePartQueue.poll();
    if (mpNext == null) {
      messagePartInProgress = false;
    } else if (!closed){
      // Session may have been closed unexpectedly in the middle of
      // sending a fragmented message closing the endpoint. If this
      // happens, clearly there is no point trying to send the rest of
      // the message.
      doWrite = true;
    }
  }
  if (doWrite) {
    // Actual write has to be outside sync block to avoid possible
    // deadlock between messagePartLock and writeLock in
    // o.a.coyote.http11.upgrade.AbstractServletOutputStream
    writeMessagePart(mpNext);
  }
  wsSession.updateLastActive();
  // Some handlers, such as the IntermediateMessageHandler, do not have a
  // nested handler so handler may be null.
  if (handler != null) {
    handler.onResult(result);
  }
}

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

void endMessage(SendHandler handler, SendResult result) {
  boolean doWrite = false;
  MessagePart mpNext = null;
  synchronized (messagePartLock) {
    fragmented = nextFragmented;
    text = nextText;
    mpNext = messagePartQueue.poll();
    if (mpNext == null) {
      messagePartInProgress = false;
    } else if (!closed){
      // Session may have been closed unexpectedly in the middle of
      // sending a fragmented message closing the endpoint. If this
      // happens, clearly there is no point trying to send the rest of
      // the message.
      doWrite = true;
    }
  }
  if (doWrite) {
    // Actual write has to be outside sync block to avoid possible
    // deadlock between messagePartLock and writeLock in
    // o.a.coyote.http11.upgrade.AbstractServletOutputStream
    writeMessagePart(mpNext);
  }
  wsSession.updateLastActive();
  // Some handlers, such as the IntermediateMessageHandler, do not have a
  // nested handler so handler may be null.
  if (handler != null) {
    handler.onResult(result);
  }
}

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

protected void processInputBuffer() throws IOException {
  while (true) {
    wsSession.updateLastActive();
    if (state == State.NEW_FRAME) {
      if (!processInitialHeader()) {
        break;
      }
      // If a close frame has been received, no further data should
      // have seen
      if (!open) {
        throw new IOException(MESSAGES.receivedFrameAfterClose());
      }
    }
    if (state == State.PARTIAL_HEADER) {
      if (!processRemainingHeader()) {
        break;
      }
    }
    if (state == State.DATA) {
      if (!processData()) {
        break;
      }
    }
  }
}

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

protected void processInputBuffer() throws IOException {
  while (true) {
    wsSession.updateLastActive();
    if (state == State.NEW_FRAME) {
      if (!processInitialHeader()) {
        break;
      }
      // If a close frame has been received, no further data should
      // have seen
      if (!open) {
        throw new IOException(sm.getString("wsFrame.closed"));
      }
    }
    if (state == State.PARTIAL_HEADER) {
      if (!processRemainingHeader()) {
        break;
      }
    }
    if (state == State.DATA) {
      if (!processData()) {
        break;
      }
    }
  }
}

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

protected void processInputBuffer() throws IOException {
  while (true) {
    wsSession.updateLastActive();
    if (state == State.NEW_FRAME) {
      if (!processInitialHeader()) {
        break;
      }
      // If a close frame has been received, no further data should
      // have seen
      if (!open) {
        throw new IOException(sm.getString("wsFrame.closed"));
      }
    }
    if (state == State.PARTIAL_HEADER) {
      if (!processRemainingHeader()) {
        break;
      }
    }
    if (state == State.DATA) {
      if (!processData()) {
        break;
      }
    }
  }
}

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

protected void processInputBuffer() throws IOException {
  while (!isSuspended()) {
    wsSession.updateLastActive();
    if (state == State.NEW_FRAME) {
      if (!processInitialHeader()) {
        break;
      }
      // If a close frame has been received, no further data should
      // have seen
      if (!open) {
        throw new IOException(sm.getString("wsFrame.closed"));
      }
    }
    if (state == State.PARTIAL_HEADER) {
      if (!processRemainingHeader()) {
        break;
      }
    }
    if (state == State.DATA) {
      if (!processData()) {
        break;
      }
    }
  }
}

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

protected void processInputBuffer() throws IOException {
  while (!isSuspended()) {
    wsSession.updateLastActive();
    if (state == State.NEW_FRAME) {
      if (!processInitialHeader()) {
        break;
      }
      // If a close frame has been received, no further data should
      // have seen
      if (!open) {
        throw new IOException(sm.getString("wsFrame.closed"));
      }
    }
    if (state == State.PARTIAL_HEADER) {
      if (!processRemainingHeader()) {
        break;
      }
    }
    if (state == State.DATA) {
      if (!processData()) {
        break;
      }
    }
  }
}

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

void startMessage(byte opCode, ByteBuffer payload, boolean last,
    SendHandler handler) {
  wsSession.updateLastActive();

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

void startMessage(byte opCode, ByteBuffer payload, boolean last,
    SendHandler handler) {
  wsSession.updateLastActive();

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

void startMessage(byte opCode, ByteBuffer payload, boolean last,
    SendHandler handler) {
  wsSession.updateLastActive();

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

void startMessage(byte opCode, ByteBuffer payload, boolean last,
    SendHandler handler) {
  wsSession.updateLastActive();

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

void startMessage(byte opCode, ByteBuffer payload, boolean last,
    SendHandler handler) {
  wsSession.updateLastActive();
  MessagePart mp = new MessagePart(opCode, payload, last, handler, this);
  synchronized (messagePartLock) {
    if (Constants.OPCODE_CLOSE == mp.getOpCode()) {
      try {
        setBatchingAllowed(false);
      } catch (IOException e) {
        log.warn(sm.getString(
            "wsRemoteEndpoint.flushOnCloseFailed"), e);
      }
    }
    if (messagePartInProgress) {
      // When a control message is sent while another message is being
      // the control message is queued. Chances are the subsequent
      // data message part will end up queued while the control
      // message is sent. The logic in this class (state machine,
      // EndMessageHanlder, TextMessageSendHandler) ensures that there
      // will only ever be one data message part in the queue. There
      // could be multiple control messages in the queue.
      // Add it to the queue
      messagePartQueue.add(mp);
    } else {
      messagePartInProgress = true;
      writeMessagePart(mp);
    }
  }
}

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

private void sendMessageBlock(byte opCode, ByteBuffer payload, boolean last,
    long timeoutExpiry) throws IOException {
  wsSession.updateLastActive();

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

private void sendMessageBlock(byte opCode, ByteBuffer payload, boolean last,
    long timeoutExpiry) throws IOException {
  wsSession.updateLastActive();

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