org.jboss.threads.QueueExecutor.setCoreThreads()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(65)

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

QueueExecutor.setCoreThreads介绍

暂无

代码示例

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

/** {@inheritDoc} */
public void setMaxThreads(final int maxThreads) {
  final Lock lock = this.lock;
  lock.lock();
  try {
    final int oldLimit = this.maxThreads;
    if (maxThreads < coreThreads) {
      // don't let the max thread limit be less than the core thread limit.
      // the called method will signal as needed
      setCoreThreads(maxThreads);
    } else if (oldLimit < maxThreads) {
      // we're growing the number of extra threads
      // therefore signal anyone waiting to add tasks; there might be more threads to add
      removeCondition.signalAll();
    } else if (oldLimit > maxThreads) {
      // we're shrinking the number of extra threads
      // therefore signal anyone waiting to remove tasks so the pool can shrink properly
      enqueueCondition.signalAll();
    } else {
      // we aren't changing anything...
      return;
    }
    this.maxThreads = maxThreads;
  } finally {
    lock.unlock();
  }
}

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

void setCoreThreads(int coreThreads) {
  executor.setCoreThreads(coreThreads);
}

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

/** {@inheritDoc} */
public void setMaxThreads(final int maxThreads) {
  final Lock lock = this.lock;
  lock.lock();
  try {
    final int oldLimit = this.maxThreads;
    if (maxThreads < coreThreads) {
      // don't let the max thread limit be less than the core thread limit.
      // the called method will signal as needed
      setCoreThreads(maxThreads);
    } else if (oldLimit < maxThreads) {
      // we're growing the number of extra threads
      // therefore signal anyone waiting to add tasks; there might be more threads to add
      removeCondition.signalAll();
    } else if (oldLimit > maxThreads) {
      // we're shrinking the number of extra threads
      // therefore signal anyone waiting to remove tasks so the pool can shrink properly
      enqueueCondition.signalAll();
    } else {
      // we aren't changing anything...
      return;
    }
    this.maxThreads = maxThreads;
  } finally {
    lock.unlock();
  }
}

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

/** {@inheritDoc} */
public void setMaxThreads(final int maxThreads) {
  final Lock lock = this.lock;
  lock.lock();
  try {
    final int oldLimit = this.maxThreads;
    if (maxThreads < coreThreads) {
      // don't let the max thread limit be less than the core thread limit.
      // the called method will signal as needed
      setCoreThreads(maxThreads);
    } else if (oldLimit < maxThreads) {
      // we're growing the number of extra threads
      // therefore signal anyone waiting to add tasks; there might be more threads to add
      removeCondition.signalAll();
    } else if (oldLimit > maxThreads) {
      // we're shrinking the number of extra threads
      // therefore signal anyone waiting to remove tasks so the pool can shrink properly
      enqueueCondition.signalAll();
    } else {
      // we aren't changing anything...
      return;
    }
    this.maxThreads = maxThreads;
  } finally {
    lock.unlock();
  }
}

相关文章