@VisibleForTesting
RevivingScheduledExecutor(
final ThreadFactory threadFactory,
final String threadName,
final long initialDelayMs,
final long timeoutMs) {
super(0);
checkNotNull(threadFactory, "threadFactory must not be null");
INSTANCE_COUNTER.incrementAndGet();
this.initialDelayMs = initialDelayMs;
this.timeoutMs = timeoutMs;
setRemoveOnCancelPolicy(true);
setThreadFactory(
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
logger.debug("Creating new thread for: {}", threadName);
Thread thread = threadFactory.newThread(r);
try {
thread.setName(threadName);
thread.setDaemon(true);
} catch (AccessControlException ignore) {
// Unsupported on App Engine.
}
if (requestedRestart.getAndSet(false)) {
afterRestart();
}
return thread;
}
});
}
RevivingScheduledExecutor.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:firebase-admin-java
作者:
评论列表
文章目录