Removed registry state checks in ComponentState

The init()/destroy() methods are only called from the registry, which
won't call them if it is in the failed state anyway.
This commit is contained in:
Emmanuel BENOîT 2015-09-17 22:17:39 +02:00
parent 5e433f940d
commit da28d57f10

View file

@ -324,15 +324,10 @@ public final class ComponentState
* *
* @throws ComponentInitialisationException * @throws ComponentInitialisationException
* if an error occurs while executing an initialisation action * if an error occurs while executing an initialisation action
* @throws IllegalStateException
* if the registry has failed
*/ */
void init( ) void init( )
throws ComponentInitialisationException , IllegalStateException throws ComponentInitialisationException
{ {
if ( this.registry.hasFailed( ) ) {
throw new IllegalStateException( "registry has failed" );
}
if ( this.initialised ) { if ( this.initialised ) {
return; return;
} }
@ -358,14 +353,11 @@ public final class ComponentState
* @throws ComponentDestructionException * @throws ComponentDestructionException
* if an error occurs while executing a destruction action * if an error occurs while executing a destruction action
* @throws IllegalStateException * @throws IllegalStateException
* if the registry has failed or if the component is active * if the component is active
*/ */
void destroy( ) void destroy( )
throws IllegalStateException , ComponentDestructionException throws IllegalStateException , ComponentDestructionException
{ {
if ( this.registry.hasFailed( ) ) {
throw new IllegalStateException( "registry has failed" );
}
if ( this.active ) { if ( this.active ) {
throw new IllegalStateException( "attempting to destroy active component" ); throw new IllegalStateException( "attempting to destroy active component" );
} }