@Override
    public synchronized void run() {
        if (initFailed) {
            throw new IllegalStateException("Client module main failed initialization");
        }
        if (!readyToRun) {
            try {
                this.wait(MAX_WAIT_TO_LAUNCH);
            } catch (InterruptedException e) {
                // Auto-FFDC
            } finally {
                if (initFailed) {
                    throw new IllegalStateException("Client module main failed initialization");
                }
                if (!readyToRun) {
                    throw new IllegalStateException("Failed to initialize client prior to attempted invocation.");
                }
            }
        }

        Method mainMethod = null;
        Object appParms[] = { getUserAppArgs() };

        ClassLoader origLoader = AccessController.doPrivileged(new ClientModuleRuntimeContainer.GetTCCL());
        ClassLoader newLoader = AccessController.doPrivileged(new ClientModuleRuntimeContainer.SetTCCL(classLoader));
        // Launch static main method of the client application.
        try {
            ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().beginContext(cmd);

            Class<String[]> parms = String[].class;
            mainMethod = mainClass.getMethod("main", parms);
            processPostConstruct();
            mainMethod.invoke(null, appParms);
            processPreDestroy();
        } catch (Exception e) {
            invokeException = e;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Exception occurred invoking main method", e);
            }
        } finally {
            if (origLoader != newLoader) {
                AccessController.doPrivileged(new ClientModuleRuntimeContainer.SetTCCL(origLoader));
            }
            ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().endContext();
        }
    }
@ Override public synchronized void run ( ) { if ( initFailed ) { throw new IllegalStateException ( "Client module main failed initialization" ) ; } if ( ! readyToRun ) { try { this . wait ( MAX_WAIT_TO_LAUNCH ) ; } catch ( InterruptedException e ) { } finally { if ( initFailed ) { throw new IllegalStateException ( "Client module main failed initialization" ) ; } if ( ! readyToRun ) { throw new IllegalStateException ( "Failed to initialize client prior to attempted invocation." ) ; } } } Method mainMethod = null ; Object appParms [ ] = { getUserAppArgs ( ) } ; ClassLoader origLoader = AccessController . doPrivileged ( new ClientModuleRuntimeContainer . GetTCCL ( ) ) ; ClassLoader newLoader = AccessController . doPrivileged ( new ClientModuleRuntimeContainer . SetTCCL ( classLoader ) ) ; try { ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . beginContext ( cmd ) ; Class < String [ ] > parms = String [ ] . class ; mainMethod = mainClass . getMethod ( "main" , parms ) ; processPostConstruct ( ) ; mainMethod . invoke ( null , appParms ) ; processPreDestroy ( ) ; } catch ( Exception e ) { invokeException = e ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception occurred invoking main method" , e ) ; } } finally { if ( origLoader != newLoader ) { AccessController . doPrivileged ( new ClientModuleRuntimeContainer . SetTCCL ( origLoader ) ) ; } ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . endContext ( ) ; } }
{@inheritDoc}