From 5dc2a544d39688419f6450afe8582b793b7d4a08 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 10 Feb 2012 11:37:41 +0000
Subject: [PATCH] Preparation work for OPENDJ-420: Rare SSLExceptions while handling LDAPS connections and big LDAP searches
---
opends/src/server/org/opends/server/extensions/RedirectingByteChannel.java | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/RedirectingByteChannel.java b/opends/src/server/org/opends/server/extensions/RedirectingByteChannel.java
index f93abd2..134fdce 100644
--- a/opends/src/server/org/opends/server/extensions/RedirectingByteChannel.java
+++ b/opends/src/server/org/opends/server/extensions/RedirectingByteChannel.java
@@ -59,7 +59,6 @@
private final ByteChannel child;
-
private volatile ByteChannel redirect = null;
@@ -76,9 +75,10 @@
*/
public void close() throws IOException
{
- if (redirect != null)
+ final ByteChannel tmp = redirect;
+ if (tmp != null)
{
- redirect.close();
+ tmp.close();
}
else
{
@@ -103,11 +103,15 @@
*/
public boolean isOpen()
{
- if (redirect != null)
+ final ByteChannel tmp = redirect;
+ if (tmp != null)
{
- return redirect.isOpen();
+ return tmp.isOpen();
}
- return child.isOpen();
+ else
+ {
+ return child.isOpen();
+ }
}
@@ -117,9 +121,10 @@
*/
public int read(final ByteBuffer buffer) throws IOException
{
- if (redirect != null)
+ final ByteChannel tmp = redirect;
+ if (tmp != null)
{
- return redirect.read(buffer);
+ return tmp.read(buffer);
}
else
{
@@ -148,9 +153,10 @@
*/
public int write(final ByteBuffer buffer) throws IOException
{
- if (redirect != null)
+ final ByteChannel tmp = redirect;
+ if (tmp != null)
{
- return redirect.write(buffer);
+ return tmp.write(buffer);
}
else
{
--
Gitblit v1.10.0