~james-page/ubuntu/natty/tomcat6/fix-662588

« back to all changes in this revision

Viewing changes to java/org/apache/catalina/util/InstanceSupport.java

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Iulian Udrea
  • Date: 2009-06-09 12:35:19 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090609123519-7owjbso5ttnka6ur
Tags: 6.0.20-1ubuntu1
[ Iulian Udrea ]
* Merge from debian unstable (LP: #385262), remaining changes:
  - debian/control, debian/rules: Use default-jdk to build
  - debian/control: Run using default-jre-headless by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 * registered InstanceListeners.
34
34
 *
35
35
 * @author Craig R. McClanahan
36
 
 * @version $Id: InstanceSupport.java 510474 2007-02-22 12:24:04Z remm $
 
36
 * @version $Id: InstanceSupport.java 771009 2009-05-03 01:15:41Z markt $
37
37
 */
38
38
 
39
39
public final class InstanceSupport {
64
64
     * The set of registered InstanceListeners for event notifications.
65
65
     */
66
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
    /**
95
97
     */
96
98
    public void addInstanceListener(InstanceListener listener) {
97
99
 
98
 
      synchronized (listeners) {
 
100
      synchronized (listenersLock) {
99
101
          InstanceListener results[] =
100
102
            new InstanceListener[listeners.length + 1];
101
103
          for (int i = 0; i < listeners.length; i++)
312
314
     */
313
315
    public void removeInstanceListener(InstanceListener listener) {
314
316
 
315
 
        synchronized (listeners) {
 
317
        synchronized (listenersLock) {
316
318
            int n = -1;
317
319
            for (int i = 0; i < listeners.length; i++) {
318
320
                if (listeners[i] == listener) {