use of java.util.concurrent.ScheduledThreadPoolExecutor in project hadoop by apache.
the class SchedulerService method init.
@Override
public void init() throws ServiceException {
int threads = getServiceConfig().getInt(CONF_THREADS, 5);
scheduler = new ScheduledThreadPoolExecutor(threads);
LOG.debug("Scheduler started");
}
use of java.util.concurrent.ScheduledThreadPoolExecutor in project android_frameworks_base by ResurrectionRemix.
the class FileOperationService method onCreate.
@Override
public void onCreate() {
// Allow tests to pre-set these with test doubles.
if (executor == null) {
executor = new ScheduledThreadPoolExecutor(POOL_SIZE);
}
if (jobFactory == null) {
jobFactory = Job.Factory.instance;
}
if (DEBUG)
Log.d(TAG, "Created.");
mPowerManager = getSystemService(PowerManager.class);
mNotificationManager = getSystemService(NotificationManager.class);
}
use of java.util.concurrent.ScheduledThreadPoolExecutor in project jdk8u_jdk by JetBrains.
the class ZeroCorePoolSize method test.
void test(String[] args) throws Throwable {
ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(0);
Runnable task = new Runnable() {
public void run() {
taskRun = true;
}
};
check(pool.getCorePoolSize() == 0);
pool.schedule(task, 1, TimeUnit.SECONDS);
pool.shutdown();
check(pool.awaitTermination(20L, TimeUnit.SECONDS));
check(pool.getCorePoolSize() == 0);
check(taskRun);
}
use of java.util.concurrent.ScheduledThreadPoolExecutor in project jersey by jersey.
the class SimpleContainer method reload.
@Override
public void reload(final ResourceConfig configuration) {
appHandler.onShutdown(this);
appHandler = new ApplicationHandler(configuration.register(new SimpleBinder()));
scheduler = new ScheduledThreadPoolExecutor(2, new DaemonFactory(TimeoutDispatcher.class));
appHandler.onReload(this);
appHandler.onStartup(this);
}
use of java.util.concurrent.ScheduledThreadPoolExecutor in project jersey by jersey.
the class JerseyCompletionStageRxInvokerTest method setUp.
@Before
public void setUp() throws Exception {
client = ClientBuilder.newClient().register(TerminalClientRequestFilter.class);
executor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat("jersey-rx-client-test-%d").setUncaughtExceptionHandler(new JerseyProcessingUncaughtExceptionHandler()).build());
}
Aggregations