make size of io buffers configurable

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@470390 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-11-02 15:35:46 +00:00
parent fdcc973923
commit 166a04bc58
1 changed files with 22 additions and 3 deletions

View File

@ -55,7 +55,8 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
protected int connectionTimeout = 30000; protected int connectionTimeout = 30000;
protected int soTimeout = 0; protected int soTimeout = 0;
protected int socketBufferSize = 128 * 1024; protected int socketBufferSize = 64 * 1024;
protected int ioBufferSize = 8 * 1024;
protected Socket socket; protected Socket socket;
protected DataOutputStream dataOut; protected DataOutputStream dataOut;
protected DataInputStream dataIn; protected DataInputStream dataIn;
@ -242,6 +243,20 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
this.tcpNoDelay = tcpNoDelay; this.tcpNoDelay = tcpNoDelay;
} }
/**
* @return the ioBufferSize
*/
public int getIoBufferSize(){
return this.ioBufferSize;
}
/**
* @param ioBufferSize the ioBufferSize to set
*/
public void setIoBufferSize(int ioBufferSize){
this.ioBufferSize=ioBufferSize;
}
// Implementation methods // Implementation methods
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -350,9 +365,9 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
} }
protected void initializeStreams() throws Exception { protected void initializeStreams() throws Exception {
TcpBufferedInputStream buffIn = new TcpBufferedInputStream(socket.getInputStream(), 8 * 1024); TcpBufferedInputStream buffIn = new TcpBufferedInputStream(socket.getInputStream(), ioBufferSize);
this.dataIn = new DataInputStream(buffIn); this.dataIn = new DataInputStream(buffIn);
TcpBufferedOutputStream buffOut = new TcpBufferedOutputStream(socket.getOutputStream(), 16 * 1024); TcpBufferedOutputStream buffOut = new TcpBufferedOutputStream(socket.getOutputStream(), ioBufferSize);
this.dataOut = new DataOutputStream(buffOut); this.dataOut = new DataOutputStream(buffOut);
} }
@ -375,4 +390,8 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
} }
return null; return null;
} }
} }