@Override
    public void applicationStopping(String appName)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.entry(tc, "MEF.applicationStopping for application " + appName);
        }

        synchronized (ivStateLock)
        {
            if (ivState == ACTIVE_STATE)
            {
                // No thread is ever waiting for a notification while
                // in the active state, so simply change state to
                // indicate deactivate is pending.
                ivState = DEACTIVATE_PENDING_STATE;
            }
            else if (ivState == ACTIVATING_STATE)
            {
                // Change state to indicate deactivate is pending
                // and notify any thread that is waiting for the activate
                // to complete.
                ivState = DEACTIVATE_PENDING_STATE;
                ivStateLock.notifyAll();
            }
            else if (ivState == DEACTIVATE_PENDING_STATE)
            {
                // activateendpoint threw an exception and changed
                // state to deactivate pending.  So we need to notify
                // threads that are waiting for the activate
                // to complete (e.g. threads blocked by createEndpoint
                // during the activation of an endpoint).
                ivStateLock.notifyAll();
            }
            else if (ivState == INACTIVE_STATE)
            {
                // This is possible, but not likely. For example, we could create this
                // MEF object and initialized it to INACTIVE_STATE.  An exception occurs
                // before we make it to the activateEndpoint method for this MEF.  If
                // that happens, then it is possible to get to this method while in
                // the inactive state.  So simply trace fact that this MEF was called
                // in inactive state and nothing was actually done.
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                {
                    Tr.event(tc, "MEF.applicationStopping for application " + appName
                                 + " was called for an inactive endpoint.");
                }
            }
            else
            {
                // The only other state is DEACTIVATING_STATE. This method should NEVER
                // be called while in the deactivating state. Runtime framework should call
                // this method before it ever attempts to stop the modules of an application.
                // Thus, we should not enter deactivating state until after this method is called.
                // Create FFDC log file for this problem and trace occurrence of this event.
                // No reason to throw the exception since we created it just for the purpose
                // of doing the FFDC.
                String msg = "Internal programming error - applicationStopping called for application \""
                             + appName + "\" while in deactivating state. This should NEVER occur.";
                IllegalStateException ex = new IllegalStateException(msg);
                FFDCFilter.processException(ex, CLASS_NAME + ".applicationStopping", "1208", this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                {
                    Tr.event(tc, msg);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.exit(tc, "MEF.applicationStopping for application " + appName);
        }
    }
@ Override public void applicationStopping ( String appName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "MEF.applicationStopping for application " + appName ) ; } synchronized ( ivStateLock ) { if ( ivState == ACTIVE_STATE ) { ivState = DEACTIVATE_PENDING_STATE ; } else if ( ivState == ACTIVATING_STATE ) { ivState = DEACTIVATE_PENDING_STATE ; ivStateLock . notifyAll ( ) ; } else if ( ivState == DEACTIVATE_PENDING_STATE ) { ivStateLock . notifyAll ( ) ; } else if ( ivState == INACTIVE_STATE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "MEF.applicationStopping for application " + appName + " was called for an inactive endpoint." ) ; } } else { String msg = "Internal programming error - applicationStopping called for application \"" + appName + "\" while in deactivating state. This should NEVER occur." ; IllegalStateException ex = new IllegalStateException ( msg ) ; FFDCFilter . processException ( ex , CLASS_NAME + ".applicationStopping" , "1208" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , msg ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.applicationStopping for application " + appName ) ; } }
d450478 - added entire method