@Service @ContractsProvided(value=RunLevelController.class) public class RunLevelControllerImpl extends Object implements RunLevelController
RunLevelController.ThreadingPolicy| Constructor and Description |
|---|
RunLevelControllerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
If there is a current procedure in process this method will get it
and cancel it
|
long |
getCancelTimeoutMilliseconds()
Returns the amount of time in milliseconds
the run level service will
wait after a cancel call before orphaning
services that have not yet completed execution
|
RunLevelFuture |
getCurrentProceeding()
This method will return the current proceedTo that the RunLevelController
is working on, or it will return null if the controller is not currently
moving up or down
|
int |
getCurrentRunLevel()
The current run level state.
|
Executor |
getExecutor()
Gets the executor that will be used by the system
when executing tasks.
|
int |
getMaximumUseableThreads()
Returns the current number of maximum useable threads
|
RunLevelController.ThreadingPolicy |
getThreadingPolicy()
Returns the threading policy currently being used by
this controller
|
void |
proceedTo(int runLevel)
This method will move to the given run level synchronously as per
RunLevelController.proceedToAsync(int). |
RunLevelFuture |
proceedToAsync(int runLevel)
Causes this RunLevelController to move to the specified run level for
all
RunLevel instances, orchestrating the appropriate
lifecycle events. |
void |
setCancelTimeoutMilliseconds(long cancelTimeout)
Sets the amount of time in milliseconds
the run level service will
wait after a cancel call before orphaning
services that have not yet completed execution
|
void |
setExecutor(Executor executor)
Sets the executor to use for the next job.
|
void |
setMaximumUseableThreads(int maximumThreads)
This sets the maximum number of threads that the system
can create for creation and/or destruction of threads.
|
void |
setThreadingPolicy(RunLevelController.ThreadingPolicy policy)
Sets the threading policy that will be used by
this controller.
|
public void proceedTo(int runLevel)
RunLevelControllerRunLevelController.proceedToAsync(int).proceedTo in interface RunLevelControllerrunLevel - The level that should be proceeded topublic RunLevelFuture proceedToAsync(int runLevel) throws CurrentlyRunningException, IllegalStateException
RunLevelControllerRunLevel instances, orchestrating the appropriate
lifecycle events.
If the run level specified is the same as the current run level then the RunLevelController may return immediately
proceedToAsync in interface RunLevelControllerrunLevel - the run level to move toCurrentlyRunningException - if there is currently a job running
this exception will be thrown with the currently running jobIllegalStateException - if this method is called when the
USE_NO_THREADS policy is in effectpublic RunLevelFuture getCurrentProceeding()
RunLevelControllergetCurrentProceeding in interface RunLevelControllerpublic void cancel()
RunLevelControllercancel in interface RunLevelControllerpublic int getCurrentRunLevel()
RunLevelControllergetCurrentRunLevel in interface RunLevelControllerpublic void setMaximumUseableThreads(int maximumThreads)
RunLevelControllersetMaximumUseableThreads in interface RunLevelControllermaximumThreads - The maximum number of threads that
can be used by the system for creation or destruction of
servicespublic int getMaximumUseableThreads()
RunLevelControllergetMaximumUseableThreads in interface RunLevelControllerpublic void setThreadingPolicy(RunLevelController.ThreadingPolicy policy)
RunLevelControllersetThreadingPolicy in interface RunLevelControllerpolicy - The policy that should be used by this controllerpublic RunLevelController.ThreadingPolicy getThreadingPolicy()
RunLevelControllergetThreadingPolicy in interface RunLevelControllerpublic void setExecutor(Executor executor)
RunLevelControllersetExecutor in interface RunLevelControllerexecutor - The executor to use for the
next job. If null a default executor will
be usedpublic Executor getExecutor()
RunLevelControllergetExecutor in interface RunLevelControllerpublic long getCancelTimeoutMilliseconds()
RunLevelControllergetCancelTimeoutMilliseconds in interface RunLevelControllerpublic void setCancelTimeoutMilliseconds(long cancelTimeout)
RunLevelControllerThe default value is 5000 (5 seconds). In general this value should be set to be longer than than the running time of the longest service that may be cancelled
setCancelTimeoutMilliseconds in interface RunLevelControllercancelTimeout - The amount of time in milliseconds that cancel
will wait for running services. Must be greater than 0Copyright © 2009-2014 Oracle Corporation. All Rights Reserved.