org.jvnet.hk2.component
Interface Enableable
- All Known Implementing Classes:
- DefaultRunLevelService
public interface Enableable
Contract used for enabling/disabling a service, and querying whether it
is currently enabled.
Implementors are advised to implement this contract if the functionality
they are providing can be toggled on/off during run-time.
Suppose a service class implements Runnable and Enableable
then calls to run() could presumably be disabled by calling
enable(boolean).
Implements of this contract are encouraged to throw an
IllegalStateException when a service is disabled and it is asked to
perform the gated operation (as in the case for run() above).
- Author:
- Jeff Trent
|
Method Summary |
void |
enable(boolean enabled)
Toggle the enabled state. |
boolean |
isEnabled()
|
enable
void enable(boolean enabled)
throws IllegalStateException
- Toggle the enabled state.
Implementors are encouraged to throw an IllegalStateException
if the requested enablement/disablement operation cannot be
performed for whatever reason.
- Parameters:
enabled - true to enable, and false to disable
- Throws:
IllegalStateException
isEnabled
boolean isEnabled()
- Returns:
- true if the service is currently enabled
Copyright © 2011 Oracle Corporation. All Rights Reserved.