public interface Stateful
A Stateful object transitions through the following states: Uninitialized --> Initialized --> Valid --> Released.
After the object is created, the client is responsible for initializing it prior to using the object its intended purpose.
First-use of the object should transition it to a 'Valid' state. The exact operation that constitutes first-use is left for the object to define. Invoking the operation again in a Valid state should yield delta results, i.e. only changes between current and last invocation should be returned or processed.
The client can at any time invalidate an initialized object, this should generate an internal transition back to the 'Initialized' state. Invoking the operation should again put it back in a valid state, and operation should yield the same results as if it has been invoked the first time.
Client is responsible for releasing the state.
Modifier and Type | Interface and Description |
---|---|
static class |
Stateful.State |
Modifier and Type | Method and Description |
---|---|
void |
initializeState()
Transition from 'Uninitialized' to 'Initialized'.
|
void |
invalidateState()
Transition from 'Valid' to 'Initialized' state.
|
void |
releaseState()
Release state and any resources its holding.
|
void initializeState() throws StateException
StateException
- if state could not be initialized.void invalidateState() throws StateException
StateException
- if called on a released or uninitialized object.void releaseState() throws StateException
StateException
- if called on an uninitialized or released object.