ejb3/src/main/java/org/jboss/as/ejb3/component/interceptors/ShutDownInterceptorFactory.java
public void shutdown() {
        int value;
        int oldValue;
        //set the shutdown bit
        do {
            oldValue = invocationCount;
            value = SHUTDOWN_FLAG | oldValue;
            //the component has already been shutdown
            if (oldValue == value) {
                return;
            }
        } while (!updater.compareAndSet(this, oldValue, value));

        synchronized (lock) {
            value = invocationCount;
            while (value != SHUTDOWN_FLAG) {
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                value = invocationCount;
                if((value & SHUTDOWN_FLAG) == 0) {
                    return; //component has been restarted
                }
            }
        }
    }
public void shutdown() {
        int value;
        int oldValue;
        //set the shutdown bit
        do {
            oldValue = invocationCount;
            value = SHUTDOWN_FLAG | oldValue;
            //the component has already been shutdown
            if (oldValue == value) {
                return;
            }
        } while (!updater.compareAndSet(this, oldValue, value));

        synchronized (lock) {
            value = invocationCount;
            while (value != SHUTDOWN_FLAG) {
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                value = invocationCount;
                if((value & SHUTDOWN_FLAG) == 0) {
                    return; //component has been restarted
                }
            }
        }
    }
public void shutdown ( ) { int value ; int oldValue ; //set the shutdown bit do { oldValue = invocationCount ; value = SHUTDOWN_FLAG | oldValue ; //the component has already been shutdown if ( oldValue == value ) { return ; } } while ( ! updater . compareAndSet ( this , oldValue , value ) ) ; synchronized ( lock ) { value = invocationCount ; while ( value != SHUTDOWN_FLAG ) { try { lock . wait ( ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } value = invocationCount ; if ( ( value & SHUTDOWN_FLAG ) == 0 ) { return ; //component has been restarted } } } }
Upon calling this method the EJB will be set to a shutdown state, and no further invocations will be allowed.
It will then wait for all active invocation to finish and then return.
Upon calling this method the EJB will be set to a shutdown state and no further invocations will be allowed . It will then wait for all active invocation to finish and then return .