Fix deprecation warnings

This commit is contained in:
Trustin Lee 2012-11-12 11:25:58 +09:00
parent a3acde0b73
commit c1b31f982e
2 changed files with 20 additions and 21 deletions

View File

@ -15,14 +15,14 @@
*/
package org.jboss.netty.handler.codec.http;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.util.internal.StringUtil;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* The default {@link HttpMessage} implementation.
*/
@ -143,7 +143,7 @@ public class DefaultHttpMessage implements HttpMessage {
buf.append("(version: ");
buf.append(getProtocolVersion().getText());
buf.append(", keepAlive: ");
buf.append(isKeepAlive());
buf.append(HttpHeaders.isKeepAlive(this));
buf.append(", chunked: ");
buf.append(isChunked());
buf.append(')');

View File

@ -15,9 +15,8 @@
*/
package org.jboss.netty.handler.ssl;
import java.nio.ByteBuffer;
import javax.net.ssl.SSLEngine;
import java.nio.ByteBuffer;
/**
* A {@link ByteBuffer} pool dedicated for {@link SslHandler} performance
@ -93,8 +92,12 @@ public class SslBufferPool {
* Acquire a new {@link ByteBuffer} out of the {@link SslBufferPool}
*
*/
public ByteBuffer acquireBuffer() {
return acquire();
public synchronized ByteBuffer acquireBuffer() {
if (index == 0) {
return ByteBuffer.allocate(MAX_PACKET_SIZE);
} else {
return (ByteBuffer) pool[-- index].clear();
}
}
/**
@ -102,12 +105,8 @@ public class SslBufferPool {
*
*/
@Deprecated
synchronized ByteBuffer acquire() {
if (index == 0) {
return ByteBuffer.allocate(MAX_PACKET_SIZE);
} else {
return (ByteBuffer) pool[-- index].clear();
}
ByteBuffer acquire() {
return acquireBuffer();
}
@ -116,8 +115,10 @@ public class SslBufferPool {
*
* @param buffer
*/
public void releaseBuffer(ByteBuffer buffer) {
release(buffer);
public synchronized void releaseBuffer(ByteBuffer buffer) {
if (index < maxBufferCount) {
pool[index ++] = buffer;
}
}
/**
@ -127,9 +128,7 @@ public class SslBufferPool {
*
*/
@Deprecated
synchronized void release(ByteBuffer buffer) {
if (index < maxBufferCount) {
pool[index ++] = buffer;
}
void release(ByteBuffer buffer) {
releaseBuffer(buffer);
}
}