@Service @ContractsProvided(value=RunLevelController.class) @Visibility(value=LOCAL) 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
|
Integer |
getValidationOverride()
Returns the override value for the
RunLevel.mode() field
in RunLevel services. |
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.
|
void |
setValidationOverride(Integer validationMode)
Sets the override value for the
RunLevel.mode() field
in RunLevel services. |
public void proceedTo(int runLevel)
RunLevelController
RunLevelController.proceedToAsync(int)
.proceedTo
in interface RunLevelController
runLevel
- The level that should be proceeded topublic RunLevelFuture proceedToAsync(int runLevel) throws CurrentlyRunningException, IllegalStateException
RunLevelController
RunLevel
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 RunLevelController
runLevel
- 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()
RunLevelController
getCurrentProceeding
in interface RunLevelController
public void cancel()
RunLevelController
cancel
in interface RunLevelController
public int getCurrentRunLevel()
RunLevelController
getCurrentRunLevel
in interface RunLevelController
public void setMaximumUseableThreads(int maximumThreads)
RunLevelController
setMaximumUseableThreads
in interface RunLevelController
maximumThreads
- The maximum number of threads that
can be used by the system for creation or destruction of
servicespublic int getMaximumUseableThreads()
RunLevelController
getMaximumUseableThreads
in interface RunLevelController
public void setThreadingPolicy(RunLevelController.ThreadingPolicy policy)
RunLevelController
setThreadingPolicy
in interface RunLevelController
policy
- The policy that should be used by this controllerpublic RunLevelController.ThreadingPolicy getThreadingPolicy()
RunLevelController
getThreadingPolicy
in interface RunLevelController
public void setExecutor(Executor executor)
RunLevelController
setExecutor
in interface RunLevelController
executor
- The executor to use for the
next job. If null a default executor will
be usedpublic Executor getExecutor()
RunLevelController
getExecutor
in interface RunLevelController
public long getCancelTimeoutMilliseconds()
RunLevelController
getCancelTimeoutMilliseconds
in interface RunLevelController
public void setCancelTimeoutMilliseconds(long cancelTimeout)
RunLevelController
The 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 RunLevelController
cancelTimeout
- The amount of time in milliseconds that cancel
will wait for running services. Must be greater than 0public Integer getValidationOverride()
RunLevelController
RunLevel.mode()
field
in RunLevel services. If this value is non-null then the mode will
be forced to this value. This is useful in testing scenarios where
the test would like to instantiate a run-level service without having
to instantiate all the others at a certain levelgetValidationOverride
in interface RunLevelController
RunLevel.mode()
value should bepublic void setValidationOverride(Integer validationMode)
RunLevelController
RunLevel.mode()
field
in RunLevel services. If this value is non-null then the mode will
be forced to this value. This is useful in testing scenarios where
the test would like to instantiate a run-level service without having
to instantiate all the others at a certain levelsetValidationOverride
in interface RunLevelController
validationMode
- null if there is no override or the value that the
RunLevel.mode()
value should beCopyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.