@Override
   public final void stop() {
      // Trying to stop() from FAILED is valid, but may not work
      boolean failed;

      synchronized (this) {
         try {
            while (state == ComponentStatus.STOPPING) {
               wait();
            }
            if (!state.stopAllowed()) {
               getLog().debugf("Ignoring call to stop() as current state is %s", state);
               return;
            }

            failed = state == ComponentStatus.FAILED;
            state = ComponentStatus.STOPPING;
         } catch (InterruptedException e) {
            throw new CacheException("Interrupted waiting for the component registry to stop");
         }
      }

      preStop();

      try {
         internalStop();

         postStop();
      } catch (Throwable t) {
         if (failed) {
            getLog().failedToCallStopAfterFailure(t);
         } else {
            handleLifecycleTransitionFailure(t);
         }
      } finally {
         synchronized (this) {
            state = ComponentStatus.TERMINATED;
         }
      }
   }
@ Override public final void stop ( ) { boolean failed ; synchronized ( this ) { try { while ( state == ComponentStatus . STOPPING ) { wait ( ) ; } if ( ! state . stopAllowed ( ) ) { getLog ( ) . debugf ( "Ignoring call to stop() as current state is %s" , state ) ; return ; } failed = state == ComponentStatus . FAILED ; state = ComponentStatus . STOPPING ; } catch ( InterruptedException e ) { throw new CacheException ( "Interrupted waiting for the component registry to stop" ) ; } } preStop ( ) ; try { internalStop ( ) ; postStop ( ) ; } catch ( Throwable t ) { if ( failed ) { getLog ( ) . failedToCallStopAfterFailure ( t ) ; } else { handleLifecycleTransitionFailure ( t ) ; } } finally { synchronized ( this ) { state = ComponentStatus . TERMINATED ; } } }
Stops the component and sets its status to {@link org.infinispan.lifecycle.ComponentStatus#TERMINATED} once it
is done.  If the component is not in the {@link org.infinispan.lifecycle.ComponentStatus#RUNNING} state, this is a
no-op.