Package com.emc.mongoose.base.concurrent
Class SingleTaskExecutorImpl
- java.lang.Object
-
- com.emc.mongoose.base.concurrent.SingleTaskExecutorImpl
-
- All Implemented Interfaces:
SingleTaskExecutor,TaskExecutor,java.lang.AutoCloseable,java.lang.Runnable,java.util.concurrent.Executor
public final class SingleTaskExecutorImpl extends java.lang.Object implements java.lang.Runnable, SingleTaskExecutor
-
-
Constructor Summary
Constructors Constructor Description SingleTaskExecutorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidexecute(java.lang.Runnable task)voidrun()booleanstop(java.lang.Runnable task)Atomically stop the active taskjava.lang.Runnabletask()
-
-
-
Method Detail
-
run
public final void run()
- Specified by:
runin interfacejava.lang.Runnable
-
execute
public final void execute(java.lang.Runnable task) throws java.util.concurrent.RejectedExecutionException- Specified by:
executein interfacejava.util.concurrent.Executor- Throws:
java.util.concurrent.RejectedExecutionException
-
task
public final java.lang.Runnable task()
- Specified by:
taskin interfaceSingleTaskExecutor- Returns:
- the active task instance, null if no active task is being executed at the moment
-
stop
public final boolean stop(java.lang.Runnable task)
Description copied from interface:SingleTaskExecutorAtomically stop the active task- Specified by:
stopin interfaceSingleTaskExecutor- Parameters:
task- the task to check if it is still active- Returns:
- true if the task was still active and stopped, false otherwise
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceTaskExecutor
-
-