Package hudson.remoting
Class AtmostOneThreadExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
hudson.remoting.AtmostOneThreadExecutor
- All Implemented Interfaces:
Executor
,ExecutorService
ExecutorService
that uses at most one executor.
Compared to Executors.newFixedThreadPool(1)
, this code will not keep
the thread around if it's not doing anything, freeing up resources.
- Since:
- 2.24
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitTermination
(long timeout, TimeUnit unit) void
boolean
boolean
void
shutdown()
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Constructor Details
-
AtmostOneThreadExecutor
-
AtmostOneThreadExecutor
public AtmostOneThreadExecutor()
-
-
Method Details
-
shutdown
public void shutdown() -
shutdownNow
-
isShutdown
public boolean isShutdown() -
isTerminated
public boolean isTerminated() -
awaitTermination
- Throws:
InterruptedException
-
execute
-