Switching to direct ByteBuffers

This commit is contained in:
Joakim Erdfelt 2013-02-22 12:57:36 -07:00
parent a619abdfe7
commit 5621f87c81
9 changed files with 12 additions and 12 deletions

View File

@ -117,7 +117,7 @@ public class UpgradeConnection extends AbstractConnection
@Override
public void onFillable()
{
ByteBuffer buffer = bufferPool.acquire(getInputBufferSize(),false);
ByteBuffer buffer = bufferPool.acquire(getInputBufferSize(),true);
BufferUtil.clear(buffer);
boolean readMore = false;
try

View File

@ -72,7 +72,7 @@ public class ServerReadThread extends Thread
public void run()
{
ByteBufferPool bufferPool = conn.getBufferPool();
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,false);
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,true);
BufferUtil.clearToFill(buf);
int len = 0;

View File

@ -310,7 +310,7 @@ public class BlockheadServer
LOG.debug("Read: waiting for {} frame(s) from server",expectedCount);
int startCount = incomingFrames.size();
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,false);
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,true);
BufferUtil.clearToFill(buf);
try
{
@ -403,7 +403,7 @@ public class BlockheadServer
{
LOG.debug("Entering echo thread");
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,false);
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,true);
BufferUtil.clearToFill(buf);
long readBytes = 0;
try

View File

@ -222,7 +222,7 @@ public class Generator
/*
* prepare the byte buffer to put frame into
*/
ByteBuffer buffer = bufferPool.acquire(windowSize,false);
ByteBuffer buffer = bufferPool.acquire(windowSize,true);
BufferUtil.clearToFill(buffer);
if (LOG.isDebugEnabled())
{

View File

@ -553,7 +553,7 @@ public class Parser
if (payload == null)
{
frame.assertValid();
payload = bufferPool.acquire(payloadLength,false);
payload = bufferPool.acquire(payloadLength,true);
BufferUtil.clearToFill(payload);
}

View File

@ -57,7 +57,7 @@ public class MuxGenerator
public void generate(long channelId, Frame frame, WriteCallback callback)
{
ByteBuffer muxPayload = bufferPool.acquire(frame.getPayloadLength() + DATA_FRAME_OVERHEAD,false);
ByteBuffer muxPayload = bufferPool.acquire(frame.getPayloadLength() + DATA_FRAME_OVERHEAD,true);
BufferUtil.flipToFill(muxPayload);
// start building mux payload
@ -90,7 +90,7 @@ public class MuxGenerator
return; // nothing to do
}
ByteBuffer payload = bufferPool.acquire(CONTROL_BUFFER_SIZE,false);
ByteBuffer payload = bufferPool.acquire(CONTROL_BUFFER_SIZE,true);
BufferUtil.flipToFill(payload);
writeChannelId(payload,0); // control channel

View File

@ -404,7 +404,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
{
LOG.debug("{} onFillable()",policy.getBehavior());
stats.countOnFillableEvents.incrementAndGet();
ByteBuffer buffer = bufferPool.acquire(getInputBufferSize(),false);
ByteBuffer buffer = bufferPool.acquire(getInputBufferSize(),true);
BufferUtil.clear(buffer);
boolean readMore = false;
try

View File

@ -44,7 +44,7 @@ public class GeneratorParserRoundtripTest
String message = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
ByteBuffer out = bufferPool.acquire(8192,false);
ByteBuffer out = bufferPool.acquire(8192,true);
try
{
// Generate Buffer
@ -80,7 +80,7 @@ public class GeneratorParserRoundtripTest
String message = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
ByteBuffer out = bufferPool.acquire(8192,false);
ByteBuffer out = bufferPool.acquire(8192,true);
try
{
// Setup Frame

View File

@ -479,7 +479,7 @@ public class BlockheadClient implements IncomingFrames, OutgoingFrames
{
LOG.debug("Read: waiting for {} frame(s) from server",expectedCount);
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,false);
ByteBuffer buf = bufferPool.acquire(BUFFER_SIZE,true);
BufferUtil.clearToFill(buf);
try
{