From ee80ecf6a7304613819cb34ca96ae74c8ee10b6e Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Thu, 10 Nov 2016 22:32:56 +0000 Subject: [PATCH] ICU-12723 Remove double-checked locking in ICUNotifier. X-SVN-Rev: 39503 --- .../core/src/com/ibm/icu/impl/ICUNotifier.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUNotifier.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUNotifier.java index 9e833723462..59fe345dadf 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUNotifier.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUNotifier.java @@ -68,7 +68,7 @@ public abstract class ICUNotifier { /** * Stop notifying this listener. The listener must - * not be null. Attemps to remove a listener that is + * not be null. Attempts to remove a listener that is * not registered will be silently ignored. */ public void removeListener(EventListener l) { @@ -98,16 +98,14 @@ public abstract class ICUNotifier { * is called on each listener from the notification thread. */ public void notifyChanged() { - if (listeners != null) { - synchronized (notifyLock) { - if (listeners != null) { - if (notifyThread == null) { - notifyThread = new NotifyThread(this); - notifyThread.setDaemon(true); - notifyThread.start(); - } - notifyThread.queue(listeners.toArray(new EventListener[listeners.size()])); + synchronized (notifyLock) { + if (listeners != null) { + if (notifyThread == null) { + notifyThread = new NotifyThread(this); + notifyThread.setDaemon(true); + notifyThread.start(); } + notifyThread.queue(listeners.toArray(new EventListener[listeners.size()])); } } }