本文整理了Java中java.util.concurrent.Executors.defaultThreadFactory()
方法的一些代码示例,展示了Executors.defaultThreadFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executors.defaultThreadFactory()
方法的具体详情如下:
包路径:java.util.concurrent.Executors
类名称:Executors
方法名:defaultThreadFactory
[英]Returns a default thread factory used to create new threads. This factory creates all new threads used by an Executor in the same ThreadGroup. Each new thread is created as a non-daemon thread with priority set to the smaller of Thread.NORM_PRIORITY and the maximum priority permitted in the thread group. New threads have names accessible via Thread#getName of pool-N-thread-M, where N is the sequence number of this factory, and M is the sequence number of the thread created by this factory.
[中]返回用于创建新线程的默认线程工厂。此工厂在同一线程组中创建执行器使用的所有新线程。每个新线程都作为非守护进程线程创建,优先级设置为线程中较小的线程。正常优先级和线程组中允许的最大优先级。新线程的名称可通过线程#getName ofpool-N-Thread-M访问,其中N是此工厂的序列号,M是此工厂创建的线程的序列号。
代码示例来源:origin: dropwizard/dropwizard
private static ThreadFactory buildThreadFactory(String nameFormat) {
return r -> {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
if (nameFormat != null) {
thread.setName(String.format(Locale.ROOT, nameFormat, COUNT.incrementAndGet()));
}
return thread;
};
}
代码示例来源:origin: dropwizard/dropwizard
private static ThreadFactory buildThreadFactory(String nameFormat, boolean daemon) {
return r -> {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
if (nameFormat != null) {
thread.setName(String.format(Locale.ROOT, nameFormat, COUNT.incrementAndGet()));
}
thread.setDaemon(daemon);
return thread;
};
}
代码示例来源:origin: aws/aws-sdk-java
@Override
public Thread newThread(Runnable runnable) {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setDaemon(true);
return thread;
}
}
代码示例来源:origin: apache/kylin
@Override
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
}
}
代码示例来源:origin: aws/aws-sdk-java
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setName("instance-profile-credentials-refresh");
t.setDaemon(true);
return t;
}
});
代码示例来源:origin: liyiorg/weixin-popular
@Override
public Thread newThread(Runnable arg0) {
Thread thread = Executors.defaultThreadFactory().newThread(arg0);
thread.setDaemon(true);
return thread;
}
});
代码示例来源:origin: liyiorg/weixin-popular
@Override
public Thread newThread(Runnable arg0) {
Thread thread = Executors.defaultThreadFactory().newThread(arg0);
//设置守护线程
thread.setDaemon(daemon);
return thread;
}
});
代码示例来源:origin: deeplearning4j/nd4j
@Override
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
}
});
代码示例来源:origin: liyiorg/weixin-popular
@Override
public Thread newThread(Runnable arg0) {
Thread thread = Executors.defaultThreadFactory().newThread(arg0);
//设置守护线程
thread.setDaemon(daemon);
return thread;
}
});
代码示例来源:origin: oracle/opengrok
@Override
public Thread newThread(Runnable runnable) {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setName("invalidate-repos-" + thread.getId());
return thread;
}
});
代码示例来源:origin: oracle/opengrok
@Override
public Thread newThread(Runnable runnable) {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setName("search-" + thread.getId());
return thread;
}
});
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable r) {
final Thread t = Executors.defaultThreadFactory().newThread(r);
t.setName("Index Provenance Events");
return t;
}
});
代码示例来源:origin: pentaho/pentaho-kettle
public Thread newThread( Runnable r ) {
Thread t = Executors.defaultThreadFactory().newThread( r );
t.setDaemon( true );
t.setName( CarteStatusCache.class.getSimpleName() );
return t;
}
} );
代码示例来源:origin: apache/hive
@Override
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setName("CachedStore-CacheUpdateService: Thread-" + t.getId());
t.setDaemon(true);
return t;
}
});
代码示例来源:origin: pentaho/pentaho-kettle
@Override public Thread newThread( Runnable r ) {
Thread thread = Executors.defaultThreadFactory().newThread( r );
thread.setDaemon( true );
thread.setName( SIMPLE_NAME + " thread " + threadNum.getAndIncrement() );
return thread;
}
} );
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable r) {
final Thread t = Executors.defaultThreadFactory().newThread(r);
t.setName("Notification Service Dispatcher");
t.setDaemon(true);
return t;
}
});
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable runnable) {
final Thread t = Executors.defaultThreadFactory().newThread(runnable);
t.setDaemon(true);
t.setName("NiFi Bootstrap Command Listener");
return t;
}
});
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable r) {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setName("Http Site-to-Site Transaction Maintenance");
thread.setDaemon(true);
return thread;
}
});
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable r) {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setName("Variable Registry Update Thread");
thread.setDaemon(true);
return thread;
}
});
代码示例来源:origin: apache/nifi
@Override
public Thread newThread(final Runnable runnable) {
final Thread t = Executors.defaultThreadFactory().newThread(runnable);
t.setDaemon(true);
t.setName("NiFi logging handler");
return t;
}
});
内容来源于网络,如有侵权,请联系作者删除!