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

(-)java/org/apache/catalina/core/StandardContext.java (-37 / +72 lines)
Lines 202-207 Link Here
202
     * application, in the order they were encountered in the web.xml file.
202
     * application, in the order they were encountered in the web.xml file.
203
     */
203
     */
204
    private String applicationListeners[] = new String[0];
204
    private String applicationListeners[] = new String[0];
205
    
206
    private final Object applicationListenersLock = new Object();
205
207
206
208
207
    /**
209
    /**
Lines 224-229 Link Here
224
    private ApplicationParameter applicationParameters[] =
226
    private ApplicationParameter applicationParameters[] =
225
        new ApplicationParameter[0];
227
        new ApplicationParameter[0];
226
228
229
    private final Object applicationParametersLock = new Object();
230
    
227
231
228
    /**
232
    /**
229
     * The application available flag for this Context.
233
     * The application available flag for this Context.
Lines 264-269 Link Here
264
     * The security constraints for this web application.
268
     * The security constraints for this web application.
265
     */
269
     */
266
    private SecurityConstraint constraints[] = new SecurityConstraint[0];
270
    private SecurityConstraint constraints[] = new SecurityConstraint[0];
271
    
272
    private final Object constraintsLock = new Object();
267
273
268
274
269
    /**
275
    /**
Lines 360-365 Link Here
360
     * they were defined in the deployment descriptor.
366
     * they were defined in the deployment descriptor.
361
     */
367
     */
362
    private FilterMap filterMaps[] = new FilterMap[0];
368
    private FilterMap filterMaps[] = new FilterMap[0];
369
    
370
    private final Object filterMapsLock = new Object();
363
371
364
372
365
    /**
373
    /**
Lines 374-379 Link Here
374
     */
382
     */
375
    private String instanceListeners[] = new String[0];
383
    private String instanceListeners[] = new String[0];
376
384
385
    private final Object instanceListenersLock = new Object();
386
377
387
378
    /**
388
    /**
379
     * The login configuration descriptor for this web application.
389
     * The login configuration descriptor for this web application.
Lines 491-496 Link Here
491
     */
501
     */
492
    private String securityRoles[] = new String[0];
502
    private String securityRoles[] = new String[0];
493
503
504
    private final Object securityRolesLock = new Object();
505
494
506
495
    /**
507
    /**
496
     * The servlet mappings for this web application, keyed by
508
     * The servlet mappings for this web application, keyed by
Lines 498-503 Link Here
498
     */
510
     */
499
    private HashMap servletMappings = new HashMap();
511
    private HashMap servletMappings = new HashMap();
500
512
513
    private final Object servletMappingsLock = new Object();
501
514
502
    /**
515
    /**
503
     * The session timeout (in minutes) for this web application.
516
     * The session timeout (in minutes) for this web application.
Lines 540-551 Link Here
540
     */
553
     */
541
    private String watchedResources[] = new String[0];
554
    private String watchedResources[] = new String[0];
542
555
556
    private final Object watchedResourcesLock = new Object();
557
543
558
544
    /**
559
    /**
545
     * The welcome files for this application.
560
     * The welcome files for this application.
546
     */
561
     */
547
    private String welcomeFiles[] = new String[0];
562
    private String welcomeFiles[] = new String[0];
548
563
564
    private final Object welcomeFilesLock = new Object();
565
549
566
550
    /**
567
    /**
551
     * The set of classnames of LifecycleListeners that will be added
568
     * The set of classnames of LifecycleListeners that will be added
Lines 553-558 Link Here
553
     */
570
     */
554
    private String wrapperLifecycles[] = new String[0];
571
    private String wrapperLifecycles[] = new String[0];
555
572
573
    private final Object wrapperLifecyclesLock = new Object();
556
574
557
    /**
575
    /**
558
     * The set of classnames of ContainerListeners that will be added
576
     * The set of classnames of ContainerListeners that will be added
Lines 560-565 Link Here
560
     */
578
     */
561
    private String wrapperListeners[] = new String[0];
579
    private String wrapperListeners[] = new String[0];
562
580
581
    private final Object wrapperListenersLock = new Object();
563
582
564
    /**
583
    /**
565
     * The pathname to the work directory for this context (relative to
584
     * The pathname to the work directory for this context (relative to
Lines 2000-2006 Link Here
2000
     */
2019
     */
2001
    public void addApplicationListener(String listener) {
2020
    public void addApplicationListener(String listener) {
2002
2021
2003
        synchronized (applicationListeners) {
2022
        synchronized (applicationListenersLock) {
2004
            String results[] =new String[applicationListeners.length + 1];
2023
            String results[] =new String[applicationListeners.length + 1];
2005
            for (int i = 0; i < applicationListeners.length; i++) {
2024
            for (int i = 0; i < applicationListeners.length; i++) {
2006
                if (listener.equals(applicationListeners[i])) {
2025
                if (listener.equals(applicationListeners[i])) {
Lines 2027-2033 Link Here
2027
     */
2046
     */
2028
    public void addApplicationParameter(ApplicationParameter parameter) {
2047
    public void addApplicationParameter(ApplicationParameter parameter) {
2029
2048
2030
        synchronized (applicationParameters) {
2049
        synchronized (applicationParametersLock) {
2031
            String newName = parameter.getName();
2050
            String newName = parameter.getName();
2032
            for (int i = 0; i < applicationParameters.length; i++) {
2051
            for (int i = 0; i < applicationParameters.length; i++) {
2033
                if (newName.equals(applicationParameters[i].getName()) &&
2052
                if (newName.equals(applicationParameters[i].getName()) &&
Lines 2124-2130 Link Here
2124
        }
2143
        }
2125
2144
2126
        // Add this constraint to the set for our web application
2145
        // Add this constraint to the set for our web application
2127
        synchronized (constraints) {
2146
        synchronized (constraintsLock) {
2128
            SecurityConstraint results[] =
2147
            SecurityConstraint results[] =
2129
                new SecurityConstraint[constraints.length + 1];
2148
                new SecurityConstraint[constraints.length + 1];
2130
            for (int i = 0; i < constraints.length; i++)
2149
            for (int i = 0; i < constraints.length; i++)
Lines 2240-2246 Link Here
2240
        }
2259
        }
2241
2260
2242
        // Add this filter mapping to our registered set
2261
        // Add this filter mapping to our registered set
2243
        synchronized (filterMaps) {
2262
        synchronized (filterMapsLock) {
2244
            FilterMap results[] =new FilterMap[filterMaps.length + 1];
2263
            FilterMap results[] =new FilterMap[filterMaps.length + 1];
2245
            System.arraycopy(filterMaps, 0, results, 0, filterMaps.length);
2264
            System.arraycopy(filterMaps, 0, results, 0, filterMaps.length);
2246
            results[filterMaps.length] = filterMap;
2265
            results[filterMaps.length] = filterMap;
Lines 2259-2265 Link Here
2259
     */
2278
     */
2260
    public void addInstanceListener(String listener) {
2279
    public void addInstanceListener(String listener) {
2261
2280
2262
        synchronized (instanceListeners) {
2281
        synchronized (instanceListenersLock) {
2263
            String results[] =new String[instanceListeners.length + 1];
2282
            String results[] =new String[instanceListeners.length + 1];
2264
            for (int i = 0; i < instanceListeners.length; i++)
2283
            for (int i = 0; i < instanceListeners.length; i++)
2265
                results[i] = instanceListeners[i];
2284
                results[i] = instanceListeners[i];
Lines 2402-2408 Link Here
2402
     */
2421
     */
2403
    public void addSecurityRole(String role) {
2422
    public void addSecurityRole(String role) {
2404
2423
2405
        synchronized (securityRoles) {
2424
        synchronized (securityRolesLock) {
2406
            String results[] =new String[securityRoles.length + 1];
2425
            String results[] =new String[securityRoles.length + 1];
2407
            for (int i = 0; i < securityRoles.length; i++)
2426
            for (int i = 0; i < securityRoles.length; i++)
2408
                results[i] = securityRoles[i];
2427
                results[i] = securityRoles[i];
Lines 2453-2459 Link Here
2453
                (sm.getString("standardContext.servletMap.pattern", pattern));
2472
                (sm.getString("standardContext.servletMap.pattern", pattern));
2454
2473
2455
        // Add this mapping to our registered set
2474
        // Add this mapping to our registered set
2456
        synchronized (servletMappings) {
2475
        synchronized (servletMappingsLock) {
2457
            String name2 = (String) servletMappings.get(pattern);
2476
            String name2 = (String) servletMappings.get(pattern);
2458
            if (name2 != null) {
2477
            if (name2 != null) {
2459
                // Don't allow more than one servlet on the same pattern
2478
                // Don't allow more than one servlet on the same pattern
Lines 2497-2503 Link Here
2497
     */
2516
     */
2498
    public void addWatchedResource(String name) {
2517
    public void addWatchedResource(String name) {
2499
2518
2500
        synchronized (watchedResources) {
2519
        synchronized (watchedResourcesLock) {
2501
            String results[] = new String[watchedResources.length + 1];
2520
            String results[] = new String[watchedResources.length + 1];
2502
            for (int i = 0; i < watchedResources.length; i++)
2521
            for (int i = 0; i < watchedResources.length; i++)
2503
                results[i] = watchedResources[i];
2522
                results[i] = watchedResources[i];
Lines 2516-2522 Link Here
2516
     */
2535
     */
2517
    public void addWelcomeFile(String name) {
2536
    public void addWelcomeFile(String name) {
2518
2537
2519
        synchronized (welcomeFiles) {
2538
        synchronized (welcomeFilesLock) {
2520
            // Welcome files from the application deployment descriptor
2539
            // Welcome files from the application deployment descriptor
2521
            // completely replace those from the default conf/web.xml file
2540
            // completely replace those from the default conf/web.xml file
2522
            if (replaceWelcomeFiles) {
2541
            if (replaceWelcomeFiles) {
Lines 2543-2549 Link Here
2543
     */
2562
     */
2544
    public void addWrapperLifecycle(String listener) {
2563
    public void addWrapperLifecycle(String listener) {
2545
2564
2546
        synchronized (wrapperLifecycles) {
2565
        synchronized (wrapperLifecyclesLock) {
2547
            String results[] =new String[wrapperLifecycles.length + 1];
2566
            String results[] =new String[wrapperLifecycles.length + 1];
2548
            for (int i = 0; i < wrapperLifecycles.length; i++)
2567
            for (int i = 0; i < wrapperLifecycles.length; i++)
2549
                results[i] = wrapperLifecycles[i];
2568
                results[i] = wrapperLifecycles[i];
Lines 2563-2569 Link Here
2563
     */
2582
     */
2564
    public void addWrapperListener(String listener) {
2583
    public void addWrapperListener(String listener) {
2565
2584
2566
        synchronized (wrapperListeners) {
2585
        synchronized (wrapperListenersLock) {
2567
            String results[] =new String[wrapperListeners.length + 1];
2586
            String results[] =new String[wrapperListeners.length + 1];
2568
            for (int i = 0; i < wrapperListeners.length; i++)
2587
            for (int i = 0; i < wrapperListeners.length; i++)
2569
                results[i] = wrapperListeners[i];
2588
                results[i] = wrapperListeners[i];
Lines 2595-2601 Link Here
2595
            wrapper = new StandardWrapper();
2614
            wrapper = new StandardWrapper();
2596
        }
2615
        }
2597
2616
2598
        synchronized (instanceListeners) {
2617
        synchronized (instanceListenersLock) {
2599
            for (int i = 0; i < instanceListeners.length; i++) {
2618
            for (int i = 0; i < instanceListeners.length; i++) {
2600
                try {
2619
                try {
2601
                    Class clazz = Class.forName(instanceListeners[i]);
2620
                    Class clazz = Class.forName(instanceListeners[i]);
Lines 2609-2615 Link Here
2609
            }
2628
            }
2610
        }
2629
        }
2611
2630
2612
        synchronized (wrapperLifecycles) {
2631
        synchronized (wrapperLifecyclesLock) {
2613
            for (int i = 0; i < wrapperLifecycles.length; i++) {
2632
            for (int i = 0; i < wrapperLifecycles.length; i++) {
2614
                try {
2633
                try {
2615
                    Class clazz = Class.forName(wrapperLifecycles[i]);
2634
                    Class clazz = Class.forName(wrapperLifecycles[i]);
Lines 2624-2630 Link Here
2624
            }
2643
            }
2625
        }
2644
        }
2626
2645
2627
        synchronized (wrapperListeners) {
2646
        synchronized (wrapperListenersLock) {
2628
            for (int i = 0; i < wrapperListeners.length; i++) {
2647
            for (int i = 0; i < wrapperListeners.length; i++) {
2629
                try {
2648
                try {
2630
                    Class clazz = Class.forName(wrapperListeners[i]);
2649
                    Class clazz = Class.forName(wrapperListeners[i]);
Lines 2659-2665 Link Here
2659
     */
2678
     */
2660
    public ApplicationParameter[] findApplicationParameters() {
2679
    public ApplicationParameter[] findApplicationParameters() {
2661
2680
2662
        return (applicationParameters);
2681
        synchronized (applicationParametersLock) {
2682
            return (applicationParameters);
2683
        }
2663
2684
2664
    }
2685
    }
2665
2686
Lines 2777-2783 Link Here
2777
     */
2798
     */
2778
    public String[] findInstanceListeners() {
2799
    public String[] findInstanceListeners() {
2779
2800
2780
        return (instanceListeners);
2801
        synchronized (instanceListenersLock) {
2802
            return (instanceListeners);
2803
        }
2781
2804
2782
    }
2805
    }
2783
2806
Lines 2936-2942 Link Here
2936
     */
2959
     */
2937
    public boolean findSecurityRole(String role) {
2960
    public boolean findSecurityRole(String role) {
2938
2961
2939
        synchronized (securityRoles) {
2962
        synchronized (securityRolesLock) {
2940
            for (int i = 0; i < securityRoles.length; i++) {
2963
            for (int i = 0; i < securityRoles.length; i++) {
2941
                if (role.equals(securityRoles[i]))
2964
                if (role.equals(securityRoles[i]))
2942
                    return (true);
2965
                    return (true);
Lines 2953-2959 Link Here
2953
     */
2976
     */
2954
    public String[] findSecurityRoles() {
2977
    public String[] findSecurityRoles() {
2955
2978
2956
        return (securityRoles);
2979
        synchronized (securityRolesLock) {
2980
            return (securityRoles);
2981
        }
2957
2982
2958
    }
2983
    }
2959
2984
Lines 2966-2972 Link Here
2966
     */
2991
     */
2967
    public String findServletMapping(String pattern) {
2992
    public String findServletMapping(String pattern) {
2968
2993
2969
        synchronized (servletMappings) {
2994
        synchronized (servletMappingsLock) {
2970
            return ((String) servletMappings.get(pattern));
2995
            return ((String) servletMappings.get(pattern));
2971
        }
2996
        }
2972
2997
Lines 2979-2985 Link Here
2979
     */
3004
     */
2980
    public String[] findServletMappings() {
3005
    public String[] findServletMappings() {
2981
3006
2982
        synchronized (servletMappings) {
3007
        synchronized (servletMappingsLock) {
2983
            String results[] = new String[servletMappings.size()];
3008
            String results[] = new String[servletMappings.size()];
2984
            return
3009
            return
2985
               ((String[]) servletMappings.keySet().toArray(results));
3010
               ((String[]) servletMappings.keySet().toArray(results));
Lines 3062-3068 Link Here
3062
     */
3087
     */
3063
    public boolean findWelcomeFile(String name) {
3088
    public boolean findWelcomeFile(String name) {
3064
3089
3065
        synchronized (welcomeFiles) {
3090
        synchronized (welcomeFilesLock) {
3066
            for (int i = 0; i < welcomeFiles.length; i++) {
3091
            for (int i = 0; i < welcomeFiles.length; i++) {
3067
                if (name.equals(welcomeFiles[i]))
3092
                if (name.equals(welcomeFiles[i]))
3068
                    return (true);
3093
                    return (true);
Lines 3078-3084 Link Here
3078
     * defined, a zero length array will be returned.
3103
     * defined, a zero length array will be returned.
3079
     */
3104
     */
3080
    public String[] findWatchedResources() {
3105
    public String[] findWatchedResources() {
3081
        return watchedResources;
3106
        synchronized (watchedResourcesLock) {
3107
            return watchedResources;
3108
        }
3082
    }
3109
    }
3083
    
3110
    
3084
    
3111
    
Lines 3088-3094 Link Here
3088
     */
3115
     */
3089
    public String[] findWelcomeFiles() {
3116
    public String[] findWelcomeFiles() {
3090
3117
3091
        return (welcomeFiles);
3118
        synchronized (welcomeFilesLock) {
3119
            return (welcomeFiles);
3120
        }
3092
3121
3093
    }
3122
    }
3094
3123
Lines 3099-3105 Link Here
3099
     */
3128
     */
3100
    public String[] findWrapperLifecycles() {
3129
    public String[] findWrapperLifecycles() {
3101
3130
3102
        return (wrapperLifecycles);
3131
        synchronized (wrapperLifecyclesLock) {
3132
            return (wrapperLifecycles);
3133
        }
3103
3134
3104
    }
3135
    }
3105
3136
Lines 3110-3116 Link Here
3110
     */
3141
     */
3111
    public String[] findWrapperListeners() {
3142
    public String[] findWrapperListeners() {
3112
3143
3113
        return (wrapperListeners);
3144
        synchronized (wrapperListenersLock) {
3145
            return (wrapperListeners);
3146
        }
3114
3147
3115
    }
3148
    }
3116
3149
Lines 3169-3175 Link Here
3169
     */
3202
     */
3170
    public void removeApplicationListener(String listener) {
3203
    public void removeApplicationListener(String listener) {
3171
3204
3172
        synchronized (applicationListeners) {
3205
        synchronized (applicationListenersLock) {
3173
3206
3174
            // Make sure this welcome file is currently present
3207
            // Make sure this welcome file is currently present
3175
            int n = -1;
3208
            int n = -1;
Lines 3209-3215 Link Here
3209
     */
3242
     */
3210
    public void removeApplicationParameter(String name) {
3243
    public void removeApplicationParameter(String name) {
3211
3244
3212
        synchronized (applicationParameters) {
3245
        synchronized (applicationParametersLock) {
3213
3246
3214
            // Make sure this parameter is currently present
3247
            // Make sure this parameter is currently present
3215
            int n = -1;
3248
            int n = -1;
Lines 3268-3274 Link Here
3268
     */
3301
     */
3269
    public void removeConstraint(SecurityConstraint constraint) {
3302
    public void removeConstraint(SecurityConstraint constraint) {
3270
3303
3271
        synchronized (constraints) {
3304
        synchronized (constraintsLock) {
3272
3305
3273
            // Make sure this constraint is currently present
3306
            // Make sure this constraint is currently present
3274
            int n = -1;
3307
            int n = -1;
Lines 3348-3354 Link Here
3348
     */
3381
     */
3349
    public void removeFilterMap(FilterMap filterMap) {
3382
    public void removeFilterMap(FilterMap filterMap) {
3350
3383
3351
        synchronized (filterMaps) {
3384
        synchronized (filterMapsLock) {
3352
3385
3353
            // Make sure this filter mapping is currently present
3386
            // Make sure this filter mapping is currently present
3354
            int n = -1;
3387
            int n = -1;
Lines 3384-3390 Link Here
3384
     */
3417
     */
3385
    public void removeInstanceListener(String listener) {
3418
    public void removeInstanceListener(String listener) {
3386
3419
3387
        synchronized (instanceListeners) {
3420
        synchronized (instanceListenersLock) {
3388
3421
3389
            // Make sure this welcome file is currently present
3422
            // Make sure this welcome file is currently present
3390
            int n = -1;
3423
            int n = -1;
Lines 3496-3502 Link Here
3496
     */
3529
     */
3497
    public void removeSecurityRole(String role) {
3530
    public void removeSecurityRole(String role) {
3498
3531
3499
        synchronized (securityRoles) {
3532
        synchronized (securityRolesLock) {
3500
3533
3501
            // Make sure this security role is currently present
3534
            // Make sure this security role is currently present
3502
            int n = -1;
3535
            int n = -1;
Lines 3535-3541 Link Here
3535
    public void removeServletMapping(String pattern) {
3568
    public void removeServletMapping(String pattern) {
3536
3569
3537
        String name = null;
3570
        String name = null;
3538
        synchronized (servletMappings) {
3571
        synchronized (servletMappingsLock) {
3539
            name = (String) servletMappings.remove(pattern);
3572
            name = (String) servletMappings.remove(pattern);
3540
        }
3573
        }
3541
        Wrapper wrapper = (Wrapper) findChild(name);
3574
        Wrapper wrapper = (Wrapper) findChild(name);
Lines 3570-3576 Link Here
3570
     */
3603
     */
3571
    public void removeWatchedResource(String name) {
3604
    public void removeWatchedResource(String name) {
3572
        
3605
        
3573
        synchronized (watchedResources) {
3606
        synchronized (watchedResourcesLock) {
3574
3607
3575
            // Make sure this watched resource is currently present
3608
            // Make sure this watched resource is currently present
3576
            int n = -1;
3609
            int n = -1;
Lines 3607-3613 Link Here
3607
     */
3640
     */
3608
    public void removeWelcomeFile(String name) {
3641
    public void removeWelcomeFile(String name) {
3609
3642
3610
        synchronized (welcomeFiles) {
3643
        synchronized (welcomeFilesLock) {
3611
3644
3612
            // Make sure this welcome file is currently present
3645
            // Make sure this welcome file is currently present
3613
            int n = -1;
3646
            int n = -1;
Lines 3647-3653 Link Here
3647
    public void removeWrapperLifecycle(String listener) {
3680
    public void removeWrapperLifecycle(String listener) {
3648
3681
3649
3682
3650
        synchronized (wrapperLifecycles) {
3683
        synchronized (wrapperLifecyclesLock) {
3651
3684
3652
            // Make sure this welcome file is currently present
3685
            // Make sure this welcome file is currently present
3653
            int n = -1;
3686
            int n = -1;
Lines 3686-3692 Link Here
3686
    public void removeWrapperListener(String listener) {
3719
    public void removeWrapperListener(String listener) {
3687
3720
3688
3721
3689
        synchronized (wrapperListeners) {
3722
        synchronized (wrapperListenersLock) {
3690
3723
3691
            // Make sure this welcome file is currently present
3724
            // Make sure this welcome file is currently present
3692
            int n = -1;
3725
            int n = -1;
Lines 4633-4639 Link Here
4633
        // Notify our interested LifecycleListeners
4666
        // Notify our interested LifecycleListeners
4634
        lifecycle.fireLifecycleEvent(DESTROY_EVENT, null);
4667
        lifecycle.fireLifecycleEvent(DESTROY_EVENT, null);
4635
4668
4636
        instanceListeners = new String[0];
4669
        synchronized (instanceListenersLock) {
4670
            instanceListeners = new String[0];
4671
        }
4637
4672
4638
    }
4673
    }
4639
    
4674
    
(-)java/org/apache/catalina/core/StandardHost.java (-16 / +21 lines)
Lines 72-77 Link Here
72
     * The set of aliases for this Host.
72
     * The set of aliases for this Host.
73
     */
73
     */
74
    private String[] aliases = new String[0];
74
    private String[] aliases = new String[0];
75
    
76
    private final Object aliasesLock = new Object();
75
77
76
78
77
    /**
79
    /**
Lines 491-510 Link Here
491
493
492
        alias = alias.toLowerCase();
494
        alias = alias.toLowerCase();
493
495
494
        // Skip duplicate aliases
496
        synchronized (aliasesLock) {
495
        for (int i = 0; i < aliases.length; i++) {
497
            // Skip duplicate aliases
496
            if (aliases[i].equals(alias))
498
            for (int i = 0; i < aliases.length; i++) {
497
                return;
499
                if (aliases[i].equals(alias))
500
                    return;
501
            }
502
            // Add this alias to the list
503
            String newAliases[] = new String[aliases.length + 1];
504
            for (int i = 0; i < aliases.length; i++)
505
                newAliases[i] = aliases[i];
506
            newAliases[aliases.length] = alias;
507
            aliases = newAliases;
498
        }
508
        }
499
500
        // Add this alias to the list
501
        String newAliases[] = new String[aliases.length + 1];
502
        for (int i = 0; i < aliases.length; i++)
503
            newAliases[i] = aliases[i];
504
        newAliases[aliases.length] = alias;
505
506
        aliases = newAliases;
507
508
        // Inform interested listeners
509
        // Inform interested listeners
509
        fireContainerEvent(ADD_ALIAS_EVENT, alias);
510
        fireContainerEvent(ADD_ALIAS_EVENT, alias);
510
511
Lines 533-539 Link Here
533
     */
534
     */
534
    public String[] findAliases() {
535
    public String[] findAliases() {
535
536
536
        return (this.aliases);
537
        synchronized (aliasesLock) {
538
            return (this.aliases);
539
        }
537
540
538
    }
541
    }
539
542
Lines 608-614 Link Here
608
611
609
        alias = alias.toLowerCase();
612
        alias = alias.toLowerCase();
610
613
611
        synchronized (aliases) {
614
        synchronized (aliasesLock) {
612
615
613
            // Make sure this alias is currently present
616
            // Make sure this alias is currently present
614
            int n = -1;
617
            int n = -1;
Lines 743-749 Link Here
743
     }
746
     }
744
747
745
    public String[] getAliases() {
748
    public String[] getAliases() {
746
        return aliases;
749
        synchronized (aliasesLock) {
750
            return aliases;
751
        }
747
    }
752
    }
748
753
749
    private boolean initialized=false;
754
    private boolean initialized=false;
(-)java/org/apache/catalina/tribes/membership/Membership.java (-3 / +5 lines)
Lines 56-68 Link Here
56
     */
56
     */
57
    protected MemberImpl[] members = EMPTY_MEMBERS;
57
    protected MemberImpl[] members = EMPTY_MEMBERS;
58
    
58
    
59
    private final Object membersLock = new Object();
60
    
59
    /**
61
    /**
60
      * sort members by alive time
62
      * sort members by alive time
61
      */
63
      */
62
    protected Comparator memberComparator = new MemberComparator();
64
    protected Comparator memberComparator = new MemberComparator();
63
65
64
    public Object clone() {
66
    public Object clone() {
65
        synchronized (members) {
67
        synchronized (membersLock) {
66
            Membership clone = new Membership(local, memberComparator);
68
            Membership clone = new Membership(local, memberComparator);
67
            clone.map = (HashMap) map.clone();
69
            clone.map = (HashMap) map.clone();
68
            clone.members = new MemberImpl[members.length];
70
            clone.members = new MemberImpl[members.length];
Lines 138-144 Link Here
138
     * @param member The member to add
140
     * @param member The member to add
139
     */
141
     */
140
    public synchronized MbrEntry addMember(MemberImpl member) {
142
    public synchronized MbrEntry addMember(MemberImpl member) {
141
      synchronized (members) {
143
      synchronized (membersLock) {
142
          MbrEntry entry = new MbrEntry(member);
144
          MbrEntry entry = new MbrEntry(member);
143
          if (!map.containsKey(member) ) {
145
          if (!map.containsKey(member) ) {
144
              map.put(member, entry);
146
              map.put(member, entry);
Lines 159-165 Link Here
159
     */
161
     */
160
    public void removeMember(MemberImpl member) {
162
    public void removeMember(MemberImpl member) {
161
        map.remove(member);
163
        map.remove(member);
162
        synchronized (members) {
164
        synchronized (membersLock) {
163
            int n = -1;
165
            int n = -1;
164
            for (int i = 0; i < members.length; i++) {
166
            for (int i = 0; i < members.length; i++) {
165
                if (members[i] == member || members[i].equals(member)) {
167
                if (members[i] == member || members[i].equals(member)) {
(-)java/org/apache/catalina/util/InstanceSupport.java (-2 / +4 lines)
Lines 64-69 Link Here
64
     * The set of registered InstanceListeners for event notifications.
64
     * The set of registered InstanceListeners for event notifications.
65
     */
65
     */
66
    private InstanceListener listeners[] = new InstanceListener[0];
66
    private InstanceListener listeners[] = new InstanceListener[0];
67
    
68
    private final Object listenersLock = new Object(); // Lock object for changes to listeners
67
69
68
70
69
    /**
71
    /**
Lines 95-101 Link Here
95
     */
97
     */
96
    public void addInstanceListener(InstanceListener listener) {
98
    public void addInstanceListener(InstanceListener listener) {
97
99
98
      synchronized (listeners) {
100
      synchronized (listenersLock) {
99
          InstanceListener results[] =
101
          InstanceListener results[] =
100
            new InstanceListener[listeners.length + 1];
102
            new InstanceListener[listeners.length + 1];
101
          for (int i = 0; i < listeners.length; i++)
103
          for (int i = 0; i < listeners.length; i++)
Lines 312-318 Link Here
312
     */
314
     */
313
    public void removeInstanceListener(InstanceListener listener) {
315
    public void removeInstanceListener(InstanceListener listener) {
314
316
315
        synchronized (listeners) {
317
        synchronized (listenersLock) {
316
            int n = -1;
318
            int n = -1;
317
            for (int i = 0; i < listeners.length; i++) {
319
            for (int i = 0; i < listeners.length; i++) {
318
                if (listeners[i] == listener) {
320
                if (listeners[i] == listener) {
(-)java/org/apache/catalina/util/LifecycleSupport.java (-2 / +4 lines)
Lines 66-71 Link Here
66
     * The set of registered LifecycleListeners for event notifications.
66
     * The set of registered LifecycleListeners for event notifications.
67
     */
67
     */
68
    private LifecycleListener listeners[] = new LifecycleListener[0];
68
    private LifecycleListener listeners[] = new LifecycleListener[0];
69
    
70
    private final Object listenersLock = new Object(); // Lock object for changes to listeners
69
71
70
72
71
    // --------------------------------------------------------- Public Methods
73
    // --------------------------------------------------------- Public Methods
Lines 78-84 Link Here
78
     */
80
     */
79
    public void addLifecycleListener(LifecycleListener listener) {
81
    public void addLifecycleListener(LifecycleListener listener) {
80
82
81
      synchronized (listeners) {
83
      synchronized (listenersLock) {
82
          LifecycleListener results[] =
84
          LifecycleListener results[] =
83
            new LifecycleListener[listeners.length + 1];
85
            new LifecycleListener[listeners.length + 1];
84
          for (int i = 0; i < listeners.length; i++)
86
          for (int i = 0; i < listeners.length; i++)
Lines 126-132 Link Here
126
     */
128
     */
127
    public void removeLifecycleListener(LifecycleListener listener) {
129
    public void removeLifecycleListener(LifecycleListener listener) {
128
130
129
        synchronized (listeners) {
131
        synchronized (listenersLock) {
130
            int n = -1;
132
            int n = -1;
131
            for (int i = 0; i < listeners.length; i++) {
133
            for (int i = 0; i < listeners.length; i++) {
132
                if (listeners[i] == listener) {
134
                if (listeners[i] == listener) {

Return to bug 46990