From a6cb619e21072969c9a900c64423e67b5fb6b0a2 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Thu, 05 Nov 2009 14:38:43 +0000
Subject: [PATCH] - [Issue 4302] Unexpected errors using single JNDI connection with SSL and multiple threads : Make TLS and SASL byte channel implementations Channel and ByteChannel [ReadableByteChannel/WritableByteChannel] interface compliant by blocking related operations to only occur on a single thread at any given time.
---
opendj-sdk/opends/src/server/org/opends/server/extensions/SASLByteChannel.java | 6 +++---
opendj-sdk/opends/src/server/org/opends/server/extensions/TLSByteChannel.java | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SASLByteChannel.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
index 7498594..7348209 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
@@ -199,7 +199,7 @@
/**
* {@inheritDoc}
*/
- public int read(ByteBuffer clearDst) throws IOException {
+ public synchronized int read(ByteBuffer clearDst) throws IOException {
int bytesToRead = lengthSize;
if(reading)
bytesToRead = neededBytes;
@@ -277,7 +277,7 @@
/**
* {@inheritDoc}
*/
- public int write(ByteBuffer clearSrc) throws IOException {
+ public synchronized int write(ByteBuffer clearSrc) throws IOException {
int sendBufSize = getAppBufSize();
int srcLen = clearSrc.remaining();
ByteBuffer sendBuffer = ByteBuffer.allocate(sendBufSize);
@@ -323,7 +323,7 @@
/**
* {@inheritDoc}
*/
- public void close() throws IOException {
+ public synchronized void close() throws IOException {
saslContext.dispose();
saslContext=null;
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSByteChannel.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSByteChannel.java
index 084394c..a363aab 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSByteChannel.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TLSByteChannel.java
@@ -205,7 +205,7 @@
/**
* {@inheritDoc}
*/
- public int read(ByteBuffer clearBuffer) throws IOException {
+ public synchronized int read(ByteBuffer clearBuffer) throws IOException {
SSLEngineResult.HandshakeStatus hsStatus;
if(!reading)
appNetData.clear();
@@ -252,7 +252,7 @@
/**
* {@inheritDoc}
*/
- public void close() throws IOException {
+ public synchronized void close() throws IOException {
sslEngine.closeInbound();
sslEngine.closeOutbound();
SSLEngineResult.HandshakeStatus hsStatus =
@@ -328,7 +328,7 @@
/**
* {@inheritDoc}
*/
- public int write(ByteBuffer clearData) throws IOException {
+ public synchronized int write(ByteBuffer clearData) throws IOException {
if(!socketChannel.isOpen() || sslEngine.isOutboundDone()) {
throw new ClosedChannelException();
}
--
Gitblit v1.10.0