org.xnio.IoUtils.getThreadLocalRandom()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(121)

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

IoUtils.getThreadLocalRandom介绍

[英]Get a thread-local RNG. Do not share this instance with other threads.
[中]获取一个线程本地RNG。不要与其他线程共享此实例。

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Add a random amount of random data to the target buffer using the thread-local RNG.
 *
 * @param target the target buffer
 */
public static void addRandom(ByteBuffer target) {
  addRandom(target, IoUtils.getThreadLocalRandom());
}

代码示例来源:origin: wildfly/wildfly

/**
 * Add {@code count} bytes of random data to the target buffer using the thread-local RNG.
 *
 * @param target the target buffer
 * @param count the number of bytes to add
 */
public static void addRandom(ByteBuffer target, int count) {
  addRandom(target, IoUtils.getThreadLocalRandom(), count);
}

代码示例来源:origin: wildfly/wildfly

public void wakeupAccepts() {
  tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this);
  resumeAccepts();
  final NioTcpServerHandle[] handles = this.handles;
  final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length);
  handles[idx].wakeup(SelectionKey.OP_ACCEPT);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Add {@code count} bytes of random data to the target buffer using the thread-local RNG.
 *
 * @param target the target buffer
 * @param count the number of bytes to add
 */
public static void addRandom(ByteBuffer target, int count) {
  addRandom(target, IoUtils.getThreadLocalRandom(), count);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Add a random amount of random data to the target buffer using the thread-local RNG.
 *
 * @param target the target buffer
 */
public static void addRandom(ByteBuffer target) {
  addRandom(target, IoUtils.getThreadLocalRandom());
}

代码示例来源:origin: org.jboss.xnio/xnio-nio

public void wakeupAccepts() {
  tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this);
  resumeAccepts();
  final NioTcpServerHandle[] handles = this.handles;
  final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length);
  handles[idx].wakeup(SelectionKey.OP_ACCEPT);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void wakeupAccepts() {
  tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this);
  resumeAccepts();
  final NioTcpServerHandle[] handles = this.handles;
  final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length);
  handles[idx].wakeup(SelectionKey.OP_ACCEPT);
}

相关文章