From 5ed0ee0b93568f456869fc8bec58ccf45686284e Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 27 Sep 2013 22:27:11 +0000
Subject: [PATCH] Backport fixes for OPENDJ-672 and OPENDJ-1156: NPE in ReferenceCountedObject after shutting down directory
---
opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java b/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java
index 5d4190a..9d1877d 100644
--- a/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/ConnectionState.java
+++ b/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