| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dfdaemon.il2.core.task.impl.CoreTaskExecutorImpl
public final class CoreTaskExecutorImpl
Class CoreTaskExecutorImpl manages CoreTasks in a way, that submit(org.dfdaemon.il2.core.task.CoreTask) waits
 for task initialization (by waiting for CoreTask.preRun() complete). 
 By default, if thread terminates with error, manager will shutdown in a whole.
| Field Summary | 
|---|
| Fields inherited from interface org.dfdaemon.il2.core.task.CoreTaskExecutionCallback | 
|---|
EMPTY | 
| Constructor Summary | |
|---|---|
CoreTaskExecutorImpl()
 | 
|
| Method Summary | |
|---|---|
 void | 
awaitCompletition(CoreTask task)
Wait for task with specified time (if interrupted, simple return with no really completition guarantee).  | 
 void | 
awaitCompletition(CoreTask task,
                  long amount,
                  TimeUnit units)
Wait for task with infinite time (if interrupted, simple return with no really completition guarantee).  | 
 boolean | 
awaitTermination(long timeout,
                 TimeUnit unit)
Awaits for shutdown specified amount of time.  | 
 void | 
cancel(CoreTask task)
Cancel task with infinite wait (if interrupted, simple return with no really cancel guarantee).  | 
 void | 
cancel(CoreTask task,
       long amount,
       TimeUnit units)
Cancel with specified waittime.  | 
 boolean | 
isRunning()
 | 
 boolean | 
isTerminated()
Getter for property 'terminated'.  | 
 void | 
onTaskCompletition(CoreTask task)
Succesfull task completition.  | 
 void | 
onTaskCrash(CoreTask task,
            Throwable t)
Task crashed.  | 
 boolean | 
schedule(CoreTask task,
         CoreTaskSchedulerPolicy policy)
 | 
 void | 
setStartupCoreTasks(Map<String,CoreTask> startupCoreTasks)
Setter for property 'startupCoreTasks'.  | 
 void | 
setWaitTime(int waitSeconds)
Setter for property 'waitTime'.  | 
 void | 
shutdownNow()
Method shutdown instance.  | 
 void | 
start()
 | 
 void | 
stop()
 | 
 boolean | 
submit(CoreTask task)
Method submits task for execution with default crash handler  | 
 boolean | 
submit(CoreTask task,
       CoreTaskExecutionCallback handler)
Method submit task for execution with userdefinded crash handler.  | 
 void | 
unschedule(CoreTask task)
 | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public CoreTaskExecutorImpl()
| Method Detail | 
|---|
public boolean submit(CoreTask task)
submit in interface CoreTaskExecutortask - of type CoreTask
public boolean submit(CoreTask task,
                      CoreTaskExecutionCallback handler)
submit in interface CoreTaskExecutortask - of type CoreTaskhandler - of type CoreTaskExecutionCallback (if null, default will be used).
public void cancel(CoreTask task,
                   long amount,
                   TimeUnit units)
            throws InterruptedException
cancel in interface CoreTaskExecutortask - of type CoreTaskamount - of type longunits - of type TimeUnit
InterruptedException - whenpublic void cancel(CoreTask task)
cancel in interface CoreTaskExecutortask - of type CoreTaskpublic boolean isTerminated()
public void shutdownNow()
public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
awaitTermination in interface CoreTaskExecutortimeout - of type longunit - of type TimeUnit
InterruptedException - when
public boolean schedule(CoreTask task,
                        CoreTaskSchedulerPolicy policy)
schedule in interface CoreTaskSchedulerpublic void unschedule(CoreTask task)
unschedule in interface CoreTaskScheduler
public void awaitCompletition(CoreTask task)
                       throws InterruptedException
awaitCompletition in interface CoreTaskExecutortask - of type CoreTask
InterruptedException - on interrupt
public void awaitCompletition(CoreTask task,
                              long amount,
                              TimeUnit units)
                       throws InterruptedException
awaitCompletition in interface CoreTaskExecutortask - of type CoreTaskamount - amount of TimeUnitsunits - TimeUnits
InterruptedException - on interruptpublic void setWaitTime(int waitSeconds)
waitSeconds - Value to set for property 'waitTime'.public void setStartupCoreTasks(Map<String,CoreTask> startupCoreTasks)
startupCoreTasks - Value to set for property 'startupCoreTasks'.public void start()
start in interface Lifecyclepublic void stop()
stop in interface Lifecyclepublic boolean isRunning()
isRunning in interface Lifecyclepublic void onTaskCompletition(CoreTask task)
onTaskCompletition in interface CoreTaskExecutionCallbacktask - of type CoreTask
public void onTaskCrash(CoreTask task,
                        Throwable t)
onTaskCrash in interface CoreTaskExecutionCallbacktask - crashed instance of type CoreTaskt - of type Throwable
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||