gpt4 book ai didi

com.sun.grizzly.util.WorkerThread.updateAttachment()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 22:27:05 29 4
gpt4 key购买 nike

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

WorkerThread.updateAttachment介绍

[英]Updates Thread associated attachment according to the passed mode.
[中]根据传递的模式更新线程关联的附件。

代码示例

代码示例来源:origin: org.glassfish.external/grizzly-module

private void saveByteBuffer(SelectionKey key) {
  WorkerThread workerThread = (WorkerThread) Thread.currentThread();
  // Detach the current Thread data.
  ThreadAttachment threadAttachment =
      workerThread.updateAttachment(Mode.BYTE_BUFFER);
  // Attach it to the SelectionKey so the it can be resumed latter.
  key.attach(threadAttachment);
}

代码示例来源:origin: org.glassfish.external/grizzly-module

private void saveSecuredBufferRemainders(SelectionKey selectionKey) {
  ThreadAttachment attachment = 
      (ThreadAttachment) selectionKey.attachment();
  
  WorkerThread workerThread = (WorkerThread) Thread.currentThread();   
  if (attachment == null || workerThread.getAttachment() != attachment) {
    Controller.logger().log(Level.FINE, 
        "SelectionKey ThreadAttachment is NULL or doesn't " +
        "correspond to the current thread, when saving buffers");
    return;
  }
  
  ByteBuffer inputBB = workerThread.getInputBB();
  if (inputBB != null && inputBB.hasRemaining()) {
    workerThread.updateAttachment(attachment.getMode() | Mode.INPUT_BB);
  } else {
    workerThread.updateAttachment(attachment.getMode() & 
        (Integer.MAX_VALUE ^ Mode.INPUT_BB));
  }
  ByteBuffer outputBB = workerThread.getOutputBB();
  if (outputBB != null && outputBB.hasRemaining()) {
    workerThread.updateAttachment(attachment.getMode() | Mode.OUTPUT_BB);
  } else {
    workerThread.updateAttachment(attachment.getMode() & 
        (Integer.MAX_VALUE ^ Mode.OUTPUT_BB));
  }
}

代码示例来源:origin: com.sun.grizzly/grizzly-portunif

attachment = workerThread.updateAttachment(Mode.SSL_ENGINE);
key.attach(attachment);

代码示例来源:origin: org.glassfish.external/grizzly-module

attachment = workerThread.updateAttachment(Mode.SSL_ENGINE);
key.attach(attachment);

代码示例来源:origin: com.sun.grizzly/grizzly-config

workerThread.setOutputBB(outputBB);
final Object attachment = workerThread.updateAttachment(Mode.SSL_ENGINE);
key.attach(attachment);

代码示例来源:origin: org.glassfish.external/grizzly-module

sslEngine = newSSLEngine(key);
workerThread.setSSLEngine(sslEngine);
ThreadAttachment attachment = workerThread.updateAttachment(Mode.SSL_ENGINE);
key.attach(attachment);

代码示例来源:origin: org.glassfish.external/grizzly-module

if (isExpectingMoreData) {
  ((WorkerThread) Thread.currentThread()).updateAttachment(Mode.ATTRIBUTES_ONLY);

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