View | Details | Raw Unified | Return to bug 38795
Collapse All | Expand All

(-)jakarta-tomcat-5.0.30-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java (-63 / +69 lines)
Lines 4219-4235 Link Here
4219
        // Binding thread
4219
        // Binding thread
4220
        ClassLoader oldCCL = bindThread();
4220
        ClassLoader oldCCL = bindThread();
4221
4221
4222
        // Standard container startup
4222
        boolean mainOk = false;
4223
        if (log.isDebugEnabled())
4224
            log.debug("Processing standard container startup");
4225
4223
4226
        if (ok) {
4224
        try {
4227
4225
4228
            boolean mainOk = false;
4226
            if (ok) {
4229
            try {
4230
4227
4231
                started = true;
4228
                started = true;
4232
4229
4230
                // Standard container startup
4231
                if (log.isDebugEnabled())
4232
                    log.debug("Processing standard container startup");
4233
4233
                // Start our subordinate components, if any
4234
                // Start our subordinate components, if any
4234
                if ((loader != null) && (loader instanceof Lifecycle))
4235
                if ((loader != null) && (loader instanceof Lifecycle))
4235
                    ((Lifecycle) loader).start();
4236
                    ((Lifecycle) loader).start();
Lines 4279-4295 Link Here
4279
4280
4280
                mainOk = true;
4281
                mainOk = true;
4281
4282
4282
            } finally {
4283
                // Unbinding thread
4284
                unbindThread(oldCCL);
4285
                if (!mainOk) {
4286
                    // An exception occurred
4287
                    // Register with JMX anyway, to allow management
4288
                    registerJMX();
4289
                }
4290
            }
4283
            }
4291
4284
4285
        } finally {
4286
            // Unbinding thread
4287
            unbindThread(oldCCL);
4288
            if (!mainOk) {
4289
                // An exception occurred
4290
                // Register with JMX anyway, to allow management
4291
                registerJMX();
4292
            }
4292
        }
4293
        }
4294
4293
        if (!getConfigured()) {
4295
        if (!getConfigured()) {
4294
            log.error( "Error getConfigured");
4296
            log.error( "Error getConfigured");
4295
            ok = false;
4297
            ok = false;
Lines 4306-4344 Link Here
4306
        // Binding thread
4308
        // Binding thread
4307
        oldCCL = bindThread();
4309
        oldCCL = bindThread();
4308
4310
4309
        // Create context attributes that will be required
4311
        try {
4310
        if (ok) {
4311
            if (log.isDebugEnabled())
4312
                log.debug("Posting standard context attributes");
4313
            postWelcomeFiles();
4314
        }
4315
4312
4316
        if (ok) {
4313
            // Create context attributes that will be required
4317
            // Notify our interested LifecycleListeners
4314
            if (ok) {
4318
            lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
4315
                if (log.isDebugEnabled())
4319
        }
4316
                    log.debug("Posting standard context attributes");
4317
                postWelcomeFiles();
4318
            }
4320
4319
4321
        // Configure and call application event listeners and filters
4320
            if (ok) {
4322
        if (ok) {
4321
                // Notify our interested LifecycleListeners
4323
            if (!listenerStart()) {
4322
                lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
4324
                log.error( "Error listenerStart");
4325
                ok = false;
4326
            }
4323
            }
4327
        }
4324
4328
        if (ok) {
4325
            // Configure and call application event listeners and filters
4329
            if (!filterStart()) {
4326
            if (ok) {
4330
                log.error( "Error filterStart");
4327
                if (!listenerStart()) {
4331
                ok = false;
4328
                    log.error( "Error listenerStart");
4329
                    ok = false;
4330
                }
4331
            }
4332
            if (ok) {
4333
                if (!filterStart()) {
4334
                    log.error( "Error filterStart");
4335
                    ok = false;
4336
                }
4332
            }
4337
            }
4333
        }
4334
4338
4335
        // Load and initialize all "load on startup" servlets
4339
            // Load and initialize all "load on startup" servlets
4336
        if (ok) {
4340
            if (ok) {
4337
            loadOnStartup(findChildren());
4341
                loadOnStartup(findChildren());
4338
        }
4342
            }
4339
4343
4340
        // Unbinding thread
4344
        } finally {
4341
        unbindThread(oldCCL);
4345
            // Unbinding thread
4346
            unbindThread(oldCCL);
4347
        }
4342
4348
4343
        // Set available status depending upon startup success
4349
        // Set available status depending upon startup success
4344
        if (ok) {
4350
        if (ok) {
Lines 4501-4534 Link Here
4501
        // Binding thread
4507
        // Binding thread
4502
        ClassLoader oldCCL = bindThread();
4508
        ClassLoader oldCCL = bindThread();
4503
4509
4504
        // Stop our filters
4510
        try {
4505
        filterStop();
4506
4511
4507
        // Stop ContainerBackgroundProcessor thread
4512
            // Stop our filters
4508
        super.threadStop();
4513
            filterStop();
4509
4514
4510
        if ((manager != null) && (manager instanceof Lifecycle)) {
4515
            // Stop ContainerBackgroundProcessor thread
4511
            ((Lifecycle) manager).stop();
4516
            super.threadStop();
4512
        }
4513
4517
4514
        // Stop our application listeners
4518
            if ((manager != null) && (manager instanceof Lifecycle)) {
4515
        // I think this should be after the children are stopped,
4519
                ((Lifecycle) manager).stop();
4516
        // because now servlet destroy() is called AFTER 
4520
            }
4517
        // contextDestroyed, which is a Spec violation as noted
4518
        // Bugzilla 30762.
4519
        // listenerStop();
4520
4521
4521
        // Finalize our character set mapper
4522
            // Stop our application listeners
4522
        setCharsetMapper(null);
4523
            // I think this should be after the children are stopped,
4524
            // because now servlet destroy() is called AFTER 
4525
            // contextDestroyed, which is a Spec violation as noted
4526
            // Bugzilla 30762.
4527
            // listenerStop();
4523
4528
4524
        // Normal container shutdown processing
4529
            // Finalize our character set mapper
4525
        if (log.isDebugEnabled())
4530
            setCharsetMapper(null);
4526
            log.debug("Processing standard container shutdown");
4527
        // Notify our interested LifecycleListeners
4528
        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
4529
        started = false;
4530
4531
4531
        try {
4532
            // Normal container shutdown processing
4533
            if (log.isDebugEnabled())
4534
                log.debug("Processing standard container shutdown");
4535
            // Notify our interested LifecycleListeners
4536
            lifecycle.fireLifecycleEvent(STOP_EVENT, null);
4537
            started = false;
4532
4538
4533
            // Stop the Valves in our pipeline (including the basic), if any
4539
            // Stop the Valves in our pipeline (including the basic), if any
4534
            if (pipeline instanceof Lifecycle) {
4540
            if (pipeline instanceof Lifecycle) {

Return to bug 38795