当前位置: 首页>>代码示例>>Java>>正文


Java ForkJoinWorkerThread.setName方法代码示例

本文整理汇总了Java中java.util.concurrent.ForkJoinWorkerThread.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ForkJoinWorkerThread.setName方法的具体用法?Java ForkJoinWorkerThread.setName怎么用?Java ForkJoinWorkerThread.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ForkJoinWorkerThread的用法示例。


在下文中一共展示了ForkJoinWorkerThread.setName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExecutor

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
ExecutorService getExecutor(int asyncThreads) {
  // TODO(carl-mastrangelo): This should not be necessary.  I don't know where this should be
  // put.  Move it somewhere else, or remove it if no longer necessary.
  // See: https://github.com/grpc/grpc-java/issues/2119
  return new ForkJoinPool(asyncThreads,
      new ForkJoinWorkerThreadFactory() {
        final AtomicInteger num = new AtomicInteger();
        @Override
        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
          ForkJoinWorkerThread thread = defaultForkJoinWorkerThreadFactory.newThread(pool);
          thread.setDaemon(true);
          thread.setName("server-worker-" + "-" + num.getAndIncrement());
          return thread;
        }
      }, UncaughtExceptionHandlers.systemExit(), true /* async */);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:17,代码来源:LoadServer.java

示例2: usingWorkStealingPool

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
public void usingWorkStealingPool() {
    if (executeService != null) return;
    ForkJoinPool.ForkJoinWorkerThreadFactory threadFactory = new ForkJoinPool.ForkJoinWorkerThreadFactory() {
        
        @Override
        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
            ForkJoinWorkerThread result = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
            if (result != null) result.setName(String.format("[%s_%04d]", executeFactoryName, result.getId()));
            return result;
        }
    };
    executeService = new ForkJoinPool(usingThreadCount, threadFactory, null, true);
}
 
开发者ID:316181444,项目名称:GameServerFramework,代码行数:14,代码来源:RunnableExecuteFactory.java

示例3: newThread

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
@Override
public ForkJoinWorkerThread newThread(final ForkJoinPool pool) {
  final ForkJoinWorkerThread result = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
  result.setPriority(priority);
  result.setName(this.allThreads.getName() + " #" + threadCount.incrementAndGet());
  return result;
}
 
开发者ID:twothe,项目名称:DaVincing,代码行数:8,代码来源:PriorityThreadFactory.java

示例4: fjwtf

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
private static ForkJoinWorkerThreadFactory fjwtf(final String name) {
  AtomicLong id = new AtomicLong();
  return pool -> {
    ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
    thread.setName(name + "-" + id.incrementAndGet());
    return thread;
  };
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:9,代码来源:Exec.java

示例5: newThread

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
  final int n = setNextBit();
  ForkJoinWorkerThread thread = new ForkJoinWorkerThread(pool) {
    @Override
    protected void onTermination(Throwable exception) {
      clearBit(n);
      super.onTermination(exception);
    }
  };
  thread.setName("JobScheduler FJ pool " + n + "/" + PARALLELISM);
  thread.setPriority(Thread.NORM_PRIORITY - 1);
  return thread;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:IdeaForkJoinWorkerThreadFactory.java

示例6: newThread

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
  ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
  thread.setName(NAME_PREFIX + i++);
  return thread;
}
 
开发者ID:SonarSource,项目名称:sonar-scm-git,代码行数:7,代码来源:GitThreadFactory.java

示例7: newThread

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
    final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
    worker.setName(namePrefix + worker.getPoolIndex());
    return worker;
}
 
开发者ID:kompics,项目名称:kompics,代码行数:7,代码来源:ForkJoinScheduler.java

示例8: newThread

import java.util.concurrent.ForkJoinWorkerThread; //导入方法依赖的package包/类
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
    ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
    thread.setName(prefix + "-ForkJoinPool-worker-" + nextThreadNum());
    return thread;
}
 
开发者ID:LolHens,项目名称:LibEventManager,代码行数:7,代码来源:ProtocolProvider.java


注:本文中的java.util.concurrent.ForkJoinWorkerThread.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。