From 3d8848801b06656f425b027d16219b026bbbb2a8 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 27 Sep 2013 22:20:48 +0000
Subject: [PATCH] Fix OPENDJ-1156 - NPE in ReferenceCountedObject after shutting down directory
---
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java
index 5d4190a..9d1877d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java
@@ -98,10 +98,10 @@
@Override
boolean notifyConnectionClosed(final ConnectionState cs) {
+ cs.state = CLOSED;
for (final ConnectionEventListener listener : cs.listeners) {
listener.handleConnectionClosed();
}
- cs.state = CLOSED;
return true;
}
@@ -111,11 +111,15 @@
// Transition from valid to error state.
cs.failedDueToDisconnect = isDisconnectNotification;
cs.connectionError = error;
+ cs.state = ERROR;
+ /*
+ * FIXME: a re-entrant close will invoke close listeners before
+ * error notification has completed.
+ */
for (final ConnectionEventListener listener : cs.listeners) {
// Use the reason provided in the disconnect notification.
listener.handleConnectionError(isDisconnectNotification, error);
}
- cs.state = ERROR;
return true;
}
@@ -156,10 +160,10 @@
@Override
boolean notifyConnectionClosed(final ConnectionState cs) {
+ cs.state = ERROR_CLOSED;
for (final ConnectionEventListener listener : cs.listeners) {
listener.handleConnectionClosed();
}
- cs.state = ERROR_CLOSED;
return true;
}
},
--
Gitblit v1.10.0