Lower the ceiling on max remote packet size (so we don't allocate huge buffers) & spell it out mor explicitly

This commit is contained in:
Shikhar Bhushan
2012-04-07 20:13:38 +05:30
parent 885c602ab8
commit 431be8e7c7

View File

@@ -61,6 +61,8 @@ import java.util.concurrent.locks.ReentrantLock;
public abstract class AbstractChannel public abstract class AbstractChannel
implements Channel { implements Channel {
private static final int REMOTE_MAX_PACKET_SIZE_CEILING = 1024 * 1024;
/** Logger */ /** Logger */
protected final Logger log = LoggerFactory.getLogger(getClass()); protected final Logger log = LoggerFactory.getLogger(getClass());
@@ -118,7 +120,7 @@ public abstract class AbstractChannel
protected void init(int recipient, long remoteWinSize, long remoteMaxPacketSize) { protected void init(int recipient, long remoteWinSize, long remoteMaxPacketSize) {
this.recipient = recipient; this.recipient = recipient;
rwin = new Window.Remote(remoteWinSize, (int) Math.min(remoteMaxPacketSize, Integer.MAX_VALUE)); rwin = new Window.Remote(remoteWinSize, (int) Math.min(remoteMaxPacketSize, REMOTE_MAX_PACKET_SIZE_CEILING));
out = new ChannelOutputStream(this, trans, rwin); out = new ChannelOutputStream(this, trans, rwin);
log.info("Initialized - {}", this); log.info("Initialized - {}", this);
} }