gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-22 21:43:05 25 4
gpt4 key购买 nike

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

WorkerThreadImpl.setByteBufferType介绍

[英]Set the ByteBufferType to use when creating the ByteBuffer associated with this object.
[中]设置创建与此对象关联的字节缓冲区时要使用的ByteBufferType

代码示例

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

public Thread newThread(Runnable r) {
    WorkerThreadImpl workerThread = new WorkerThreadImpl(threadPool,
        threadPool.name + "WorkerThread-"  + threadPool.port + "-" +
        threadPool.workerThreadCounter.getAndIncrement(), r,
        threadPool.initialByteBufferSize);
    workerThread.setByteBufferType(threadPool.byteBufferType);
    workerThread.setPriority(threadPool.priority);
    return workerThread;
  }
}

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

/**
 * must hold statelock while calling this method.
 * @param wt
 */
protected void startWorker(Worker wt) {
  final Thread thread = threadFactory.newThread(wt);
  thread.setName(getName() + "(" + nextThreadId() + ")");
  thread.setUncaughtExceptionHandler(this);
  thread.setPriority(getPriority());
  thread.setDaemon(true);
  if (thread instanceof WorkerThreadImpl) {
    final WorkerThreadImpl workerThread = (WorkerThreadImpl) thread;
    workerThread.setByteBufferType(getByteBufferType());
    workerThread.setInitialByteBufferSize(getInitialByteBufferSize());
  }
  wt.t = thread;
  workers.put(wt, System.currentTimeMillis());
  wt.t.start();
}

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

/**
 * Create new {@link WorkerThreadImpl}. This method must be invoked
 * from a synchronized block.
 * @param increment - how many additional {@link WorkerThreadImpl}
 * objects to add
 * @param startThread - should newly added {@link WorkerThreadImpl}
 * objects be started after creation?
 */
protected void increaseWorkerThread(int increment, boolean startThread){
  WorkerThreadImpl workerThread;
  int currentCount = threadCount;
  int increaseCount = threadCount + increment;
  for (int i=currentCount; i < increaseCount; i++){
    workerThread = createWorkerThread(
        name + "WorkerThread-"  + port + "-" + i,
        initialByteBufferSize);
    workerThread.setByteBufferType(byteBufferType);
    workerThread.setPriority(priority);
    
    if (startThread)
      workerThread.start();
    
    workerThreads[i] = workerThread;
    threadCount++;
  }
}

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