< prev index next >
src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -248,12 +248,17 @@
*/
synchronized void removeDeadNotifier(NotifierArgs info) {
if (debug) {
System.err.println("EventSupport.removeDeadNotifier: " + info.name);
}
+ if (notifiers != null) {
+ // Only do this if cleanup() not been triggered, otherwise here
+ // will throw NullPointerException since notifiers will be set to
+ // null in cleanup()
notifiers.remove(info);
}
+ }
/**
* Fire an event to unsolicited listeners.
* package private;
* Called by LdapCtx when its clnt receives an unsolicited notification.
@@ -327,10 +332,15 @@
* them to the registered listeners.
* Package private; used by NamingEventNotifier to fire events
*/
synchronized void queueEvent(EventObject event,
Vector<? extends NamingListener> vector) {
+ if (notifiers == null) {
+ // That means cleanup() already done, not queue event anymore,
+ // otherwise, new created EventQueue will not been cleanup.
+ return;
+ }
if (eventQueue == null)
eventQueue = new EventQueue();
/*
* Copy the vector in order to freeze the state of the set
< prev index next >