From: fhanik Date: Wed, 13 Jun 2007 17:00:21 +0000 (+0000) Subject: fix for BZ 42648 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c1de14a0e5280316f8f0b87577a8e2f02728579a;p=tomcat7.0 fix for BZ 42648 http://issues.apache.org/bugzilla/show_bug.cgi?id=42648 git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@546955 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java index 7d5d6b964..6839d0606 100644 --- a/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java +++ b/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java @@ -63,12 +63,15 @@ public class NioReplicationTask extends AbstractRxTask { // loop forever waiting for work to do public synchronized void run() { - if ( (getOptions() & OPTION_DIRECT_BUFFER) == OPTION_DIRECT_BUFFER ) { - buffer = ByteBuffer.allocateDirect(getRxBufSize()); - }else { - buffer = ByteBuffer.allocate (getRxBufSize()); + if ( buffer == null ) { + if ( (getOptions() & OPTION_DIRECT_BUFFER) == OPTION_DIRECT_BUFFER) { + buffer = ByteBuffer.allocateDirect(getRxBufSize()); + } else { + buffer = ByteBuffer.allocate(getRxBufSize()); + } + } else { + buffer.clear(); } - if (key == null) { return; // just in case }