Make all methods of SslBufferPool public so a subclass can be placed in another package. See #336
This commit is contained in:
parent
d2ec45e573
commit
88d60c15c7
@ -89,6 +89,19 @@ public class SslBufferPool {
|
||||
return index * MAX_PACKET_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire a new {@link ByteBuffer} out of the {@link SslBufferPool}
|
||||
*
|
||||
*/
|
||||
public ByteBuffer acquireBuffer() {
|
||||
return acquire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will get removed. Please use {@link #acquireBuffer()}
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
synchronized ByteBuffer acquire() {
|
||||
if (index == 0) {
|
||||
return ByteBuffer.allocate(MAX_PACKET_SIZE);
|
||||
@ -96,7 +109,24 @@ public class SslBufferPool {
|
||||
return (ByteBuffer) pool[-- index].clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release a previous acquired {@link ByteBuffer}
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void releaseBuffer(ByteBuffer buffer) {
|
||||
release(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will get removed. Please use {@link #releaseBuffer(ByteBuffer)}
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
synchronized void release(ByteBuffer buffer) {
|
||||
if (index < maxBufferCount) {
|
||||
pool[index ++] = buffer;
|
||||
|
@ -670,7 +670,7 @@ public class SslHandler extends FrameDecoder
|
||||
|
||||
ChannelFuture future = null;
|
||||
ChannelBuffer msg;
|
||||
ByteBuffer outNetBuf = bufferPool.acquire();
|
||||
ByteBuffer outNetBuf = bufferPool.acquireBuffer();
|
||||
boolean success = true;
|
||||
boolean offered = false;
|
||||
boolean needsUnwrap = false;
|
||||
@ -776,7 +776,7 @@ public class SslHandler extends FrameDecoder
|
||||
setHandshakeFailure(channel, e);
|
||||
throw e;
|
||||
} finally {
|
||||
bufferPool.release(outNetBuf);
|
||||
bufferPool.releaseBuffer(outNetBuf);
|
||||
|
||||
if (offered) {
|
||||
flushPendingEncryptedWrites(context);
|
||||
@ -844,7 +844,7 @@ public class SslHandler extends FrameDecoder
|
||||
|
||||
private ChannelFuture wrapNonAppData(ChannelHandlerContext ctx, Channel channel) throws SSLException {
|
||||
ChannelFuture future = null;
|
||||
ByteBuffer outNetBuf = bufferPool.acquire();
|
||||
ByteBuffer outNetBuf = bufferPool.acquireBuffer();
|
||||
|
||||
SSLEngineResult result;
|
||||
try {
|
||||
@ -915,7 +915,7 @@ public class SslHandler extends FrameDecoder
|
||||
setHandshakeFailure(channel, e);
|
||||
throw e;
|
||||
} finally {
|
||||
bufferPool.release(outNetBuf);
|
||||
bufferPool.releaseBuffer(outNetBuf);
|
||||
}
|
||||
|
||||
if (future == null) {
|
||||
@ -928,7 +928,7 @@ public class SslHandler extends FrameDecoder
|
||||
private ChannelBuffer unwrap(
|
||||
ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, int offset, int length) throws SSLException {
|
||||
ByteBuffer inNetBuf = buffer.toByteBuffer(offset, length);
|
||||
ByteBuffer outAppBuf = bufferPool.acquire();
|
||||
ByteBuffer outAppBuf = bufferPool.acquireBuffer();
|
||||
|
||||
try {
|
||||
boolean needsWrap = false;
|
||||
@ -1019,7 +1019,7 @@ public class SslHandler extends FrameDecoder
|
||||
setHandshakeFailure(channel, e);
|
||||
throw e;
|
||||
} finally {
|
||||
bufferPool.release(outAppBuf);
|
||||
bufferPool.releaseBuffer(outAppBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user