ICU-12723 Remove double-checked locking in ICUNotifier.

X-SVN-Rev: 39503
This commit is contained in:
Andy Heninger 2016-11-10 22:32:56 +00:00
parent ac2430a58a
commit ee80ecf6a7

View File

@ -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()]));
}
}
}