Package org.glassfish.hk2.api
Interface ImmediateController
-
- All Known Implementing Classes:
ImmediateHelper
@Contract public interface ImmediateController
This service is advertised when the Immediate service is put into the registry. The immediate service by default starts in the SUSPENDED state so that the Executor and other parameters can be set prior to the first Immediate service being started
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classImmediateController.ImmediateServiceState
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.ExecutorgetExecutor()Returns the executor that is currently in use by the Immediate subsystemImmediateController.ImmediateServiceStategetImmediateState()Returns the state the system is currently running underlonggetThreadInactivityTimeout()Returns the time in milliseconds a thread will wait for new Immediate services before dyingvoidsetExecutor(java.util.concurrent.Executor executor)Sets the executor to be used by the Immediate subsystem.voidsetImmediateState(ImmediateController.ImmediateServiceState state)Sets the state the system is currently running undervoidsetThreadInactivityTimeout(long timeInMillis)Sets the time in milliseconds a thread will wait for new Immediate services before dying
-
-
-
Method Detail
-
getExecutor
java.util.concurrent.Executor getExecutor()
Returns the executor that is currently in use by the Immediate subsystem- Returns:
- The current executor in use by the controller. Will not return null since a default executor is used and returned by this call even if setExecutor is called with null
-
setExecutor
void setExecutor(java.util.concurrent.Executor executor) throws java.lang.IllegalStateExceptionSets the executor to be used by the Immediate subsystem. If set to null a default executor will be used. This may only be called when the Immediate service is suspended- Parameters:
executor- The executor to be used when scheduling work. If null a default executor implementation will be used- Throws:
java.lang.IllegalStateException- if this is called when the Immediate service is not in suspended state
-
getThreadInactivityTimeout
long getThreadInactivityTimeout()
Returns the time in milliseconds a thread will wait for new Immediate services before dying- Returns:
- The time in milliseconds a thread will wait for new Immediate service before dying
-
setThreadInactivityTimeout
void setThreadInactivityTimeout(long timeInMillis) throws java.lang.IllegalArgumentExceptionSets the time in milliseconds a thread will wait for new Immediate services before dying- Parameters:
timeInMillis- The time in milliseconds a thread will wait for new Immediate service before dying- Throws:
java.lang.IllegalArgumentException- if timeInMillis is less than zero
-
getImmediateState
ImmediateController.ImmediateServiceState getImmediateState()
Returns the state the system is currently running under- Returns:
- The current state of the ImmediateService
-
setImmediateState
void setImmediateState(ImmediateController.ImmediateServiceState state)
Sets the state the system is currently running under- Parameters:
state- The new state of the ImmediateService
-
-