public class Executor extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<Executor> |
EXECUTOR
The executor belonging to a thread.
|
Constructor and Description |
---|
Executor(IThreadPool threadpool)
Create an executor object.
|
Executor(IThreadPool threadpool,
IExecutable executable)
Create an executor object.
|
Modifier and Type | Method and Description |
---|---|
void |
blockThread(Object monitor)
Adjust to execution of current thread to be blocked.
|
boolean |
execute()
Make sure a thread is executing the code.
|
void |
run()
Execute the code.
|
void |
setExecutable(IExecutable executable)
Set the executable.
|
IFuture<Void> |
shutdown()
Shutdown the executor.
|
void |
switchThread(Object monitor,
Throwable t)
Cease execution of the current thread and
switch to another thread waiting for the given monitor.
|
String |
toString()
String representation.
|
public static final ThreadLocal<Executor> EXECUTOR
public Executor(IThreadPool threadpool)
public Executor(IThreadPool threadpool, IExecutable executable)
public boolean execute()
public void setExecutable(IExecutable executable)
executable
- The executable.public void switchThread(Object monitor, Throwable t)
monitor
- The monitor to be notified.t
- The exception to be thrown on the unblocked thread (null for continuing normal execution).public void blockThread(Object monitor)
Copyright © 2013. All Rights Reserved.