diff --git a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java index 5dd845b07b..28d75f8b94 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java @@ -231,12 +231,13 @@ public class ClientBootstrap extends Bootstrap { } /** - * Attempts to bind a channel with the specified {@code localAddress}. later the channel can be connected - * to a remoteAddress by calling {@link Channel#connect(SocketAddress)}.This method is useful where bind and connect - * need to be done in separate steps. + * Attempts to bind a channel with the specified {@code localAddress}. later the channel can + * be connected to a remoteAddress by calling {@link Channel#connect(SocketAddress)}.This method + * is useful where bind and connect need to be done in separate steps. * * This can also be useful if you want to set an attachment to the {@link Channel} via - * {@link Channel#setAttachment(Object)} so you can use it after the {@link #bind(SocketAddress)} was done. + * {@link Channel#setAttachment(Object)} so you can use it after the {@link #bind(SocketAddress)} + * was done. *
* For example: * diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java index 2329d03a42..50889b6fcd 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java @@ -1723,13 +1723,15 @@ public interface ChannelBuffer extends Comparable { String charsetName, ChannelBufferIndexFinder terminatorFinder); /** - * @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and {@link #toString(int, int, Charset)} instead. + * @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and + * {@link #toString(int, int, Charset)} instead. */ @Deprecated String toString(int index, int length, String charsetName); /** - * @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and {@link #toString(int, int, Charset)} instead. + * @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and + * {@link #toString(int, int, Charset)} instead. */ @Deprecated String toString( diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java index 6528d2cc95..2995542dc6 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java @@ -227,7 +227,8 @@ public final class ChannelBuffers { * More accurate estimation yields less unexpected reallocation overhead. * The new buffer's {@code readerIndex} and {@code writerIndex} are {@code 0}. */ - public static ChannelBuffer dynamicBuffer(ByteOrder endianness, int estimatedLength, ChannelBufferFactory factory) { + public static ChannelBuffer dynamicBuffer( + ByteOrder endianness, int estimatedLength, ChannelBufferFactory factory) { return new DynamicChannelBuffer(endianness, estimatedLength, factory); } @@ -308,7 +309,8 @@ public final class ChannelBuffers { return EMPTY_BUFFER; } if (buffer.hasArray()) { - return wrappedBuffer(buffer.order(), buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); + return wrappedBuffer( + buffer.order(), buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); } else { return new ByteBufferBackedChannelBuffer(buffer); } @@ -1050,7 +1052,8 @@ public final class ChannelBuffers { * The default implementation of {@link ChannelBuffer#indexOf(int, int, ChannelBufferIndexFinder)}. * This method is useful when implementing a new buffer type. */ - public static int indexOf(ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { + public static int indexOf( + ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { if (fromIndex <= toIndex) { return firstIndexOf(buffer, fromIndex, toIndex, indexFinder); } else { @@ -1118,7 +1121,8 @@ public final class ChannelBuffers { return -1; } - private static int firstIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { + private static int firstIndexOf( + ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { fromIndex = Math.max(fromIndex, 0); if (fromIndex >= toIndex || buffer.capacity() == 0) { return -1; @@ -1133,7 +1137,8 @@ public final class ChannelBuffers { return -1; } - private static int lastIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { + private static int lastIndexOf( + ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { fromIndex = Math.min(fromIndex, buffer.capacity()); if (fromIndex < 0 || buffer.capacity() == 0) { return -1; diff --git a/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java index 0223e303fb..178e098fef 100644 --- a/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java @@ -56,11 +56,11 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { private final Object bigEndianLock = new Object(); private final Object littleEndianLock = new Object(); - private final int preallocatedBufferCapacity; - private ChannelBuffer preallocatedBigEndianBuffer; - private int preallocatedBigEndianBufferPosition; - private ChannelBuffer preallocatedLittleEndianBuffer; - private int preallocatedLittleEndianBufferPosition; + private final int preallocatedBufCapacity; + private ChannelBuffer preallocatedBEBuf; + private int preallocatedBEBufPos; + private ChannelBuffer preallocatedLEBuf; + private int preallocatedLEBufPos; /** * Creates a new factory whose default {@link ByteOrder} is @@ -96,10 +96,10 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { super(defaultOrder); if (preallocatedBufferCapacity <= 0) { throw new IllegalArgumentException( - "preallocatedBufferCapacity must be greater than 0: " + preallocatedBufferCapacity); + "preallocatedBufCapacity must be greater than 0: " + preallocatedBufferCapacity); } - this.preallocatedBufferCapacity = preallocatedBufferCapacity; + this.preallocatedBufCapacity = preallocatedBufferCapacity; } public ChannelBuffer getBuffer(ByteOrder order, int capacity) { @@ -112,7 +112,7 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { if (capacity == 0) { return ChannelBuffers.EMPTY_BUFFER; } - if (capacity >= preallocatedBufferCapacity) { + if (capacity >= preallocatedBufCapacity) { return ChannelBuffers.directBuffer(order, capacity); } @@ -160,17 +160,17 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { private ChannelBuffer allocateBigEndianBuffer(int capacity) { ChannelBuffer slice; synchronized (bigEndianLock) { - if (preallocatedBigEndianBuffer == null) { - preallocatedBigEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufferCapacity); - slice = preallocatedBigEndianBuffer.slice(0, capacity); - preallocatedBigEndianBufferPosition = capacity; - } else if (preallocatedBigEndianBuffer.capacity() - preallocatedBigEndianBufferPosition >= capacity) { - slice = preallocatedBigEndianBuffer.slice(preallocatedBigEndianBufferPosition, capacity); - preallocatedBigEndianBufferPosition += capacity; + if (preallocatedBEBuf == null) { + preallocatedBEBuf = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufCapacity); + slice = preallocatedBEBuf.slice(0, capacity); + preallocatedBEBufPos = capacity; + } else if (preallocatedBEBuf.capacity() - preallocatedBEBufPos >= capacity) { + slice = preallocatedBEBuf.slice(preallocatedBEBufPos, capacity); + preallocatedBEBufPos += capacity; } else { - preallocatedBigEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufferCapacity); - slice = preallocatedBigEndianBuffer.slice(0, capacity); - preallocatedBigEndianBufferPosition = capacity; + preallocatedBEBuf = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufCapacity); + slice = preallocatedBEBuf.slice(0, capacity); + preallocatedBEBufPos = capacity; } } return slice; @@ -179,17 +179,17 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { private ChannelBuffer allocateLittleEndianBuffer(int capacity) { ChannelBuffer slice; synchronized (littleEndianLock) { - if (preallocatedLittleEndianBuffer == null) { - preallocatedLittleEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufferCapacity); - slice = preallocatedLittleEndianBuffer.slice(0, capacity); - preallocatedLittleEndianBufferPosition = capacity; - } else if (preallocatedLittleEndianBuffer.capacity() - preallocatedLittleEndianBufferPosition >= capacity) { - slice = preallocatedLittleEndianBuffer.slice(preallocatedLittleEndianBufferPosition, capacity); - preallocatedLittleEndianBufferPosition += capacity; + if (preallocatedLEBuf == null) { + preallocatedLEBuf = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufCapacity); + slice = preallocatedLEBuf.slice(0, capacity); + preallocatedLEBufPos = capacity; + } else if (preallocatedLEBuf.capacity() - preallocatedLEBufPos >= capacity) { + slice = preallocatedLEBuf.slice(preallocatedLEBufPos, capacity); + preallocatedLEBufPos += capacity; } else { - preallocatedLittleEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufferCapacity); - slice = preallocatedLittleEndianBuffer.slice(0, capacity); - preallocatedLittleEndianBufferPosition = capacity; + preallocatedLEBuf = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufCapacity); + slice = preallocatedLEBuf.slice(0, capacity); + preallocatedLEBufPos = capacity; } } return slice; diff --git a/src/main/java/org/jboss/netty/channel/ChannelState.java b/src/main/java/org/jboss/netty/channel/ChannelState.java index 3d14438038..3aefd47073 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelState.java +++ b/src/main/java/org/jboss/netty/channel/ChannelState.java @@ -29,46 +29,60 @@ import java.net.SocketAddress; * DirectionStateValueMeaning * * - * Upstream{@link #OPEN}{@code true}The channel is open. + * Upstream{@link #OPEN} + * {@code true}The channel is open. * * - * Upstream{@link #OPEN}{@code false}The channel is closed. + * Upstream{@link #OPEN} + * {@code false}The channel is closed. * * - * Upstream{@link #BOUND}{@link SocketAddress}The channel is bound to a local address. + * Upstream{@link #BOUND} + * {@link SocketAddress}The channel is bound to a local address. * * - * Upstream{@link #BOUND}{@code null}The channel is unbound to a local address. + * Upstream{@link #BOUND} + * {@code null}The channel is unbound to a local address. * * - * Upstream{@link #CONNECTED}{@link SocketAddress}The channel is connected to a remote address. + * Upstream{@link #CONNECTED} + * {@link SocketAddress}The channel is connected to a remote address. * * - * Upstream{@link #CONNECTED}{@code null}The channel is disconnected from a remote address. + * Upstream{@link #CONNECTED} + * {@code null}The channel is disconnected from a remote address. * * - * Upstream{@link #INTEREST_OPS}an integerThe channel interestOps has been changed. + * Upstream{@link #INTEREST_OPS} + * an integerThe channel interestOps has been changed. * * - * Downstream{@link #OPEN}{@code true}N/A + * Downstream{@link #OPEN} + * {@code true}N/A * * - * Downstream{@link #OPEN}{@code false}Close the channel. + * Downstream{@link #OPEN} + * {@code false}Close the channel. * * - * Downstream{@link #BOUND}{@link SocketAddress}Bind the channel to the specified local address. + * Downstream{@link #BOUND} + * {@link SocketAddress}Bind the channel to the specified local address. * * - * Downstream{@link #BOUND}{@code null}Unbind the channel from the current local address. + * Downstream{@link #BOUND} + * {@code null}Unbind the channel from the current local address. * * - * Downstream{@link #CONNECTED}{@link SocketAddress}Connect the channel to the specified remote address. + * Downstream{@link #CONNECTED} + * {@link SocketAddress}Connect the channel to the specified remote address. * * - * Downstream{@link #CONNECTED}{@code null}Disconnect the channel from the current remote address. + * Downstream{@link #CONNECTED} + * {@code null}Disconnect the channel from the current remote address. * * - * Downstream{@link #INTEREST_OPS}an integerChange the interestOps of the channel. + * Downstream{@link #INTEREST_OPS} + * an integerChange the interestOps of the channel. * * *

diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java index d73d2f9172..c0e7ee359e 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java @@ -55,7 +55,9 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel volatile LocalAddress localAddress; volatile LocalAddress remoteAddress; - DefaultLocalChannel(LocalServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, DefaultLocalChannel pairedChannel) { + DefaultLocalChannel( + LocalServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, + ChannelSink sink, DefaultLocalChannel pairedChannel) { super(parent, factory, pipeline, sink); this.pairedChannel = pairedChannel; config = new DefaultChannelConfig(); diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java index c47832ee3a..cc7471405b 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java @@ -43,8 +43,8 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto /** - * Release all the previous created channels. This takes care of calling {@link LocalChannelRegistry#unregister(LocalAddress)} - * for each if them. + * Release all the previous created channels. + * This takes care of calling {@link LocalChannelRegistry#unregister(LocalAddress)} for each of them. */ public void releaseExternalResources() { group.close().awaitUninterruptibly(); diff --git a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java index 30fcc229e9..a29c876275 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java @@ -15,9 +15,9 @@ */ package org.jboss.netty.channel.socket; -import java.net.DatagramSocket; import java.net.InetAddress; import java.net.NetworkInterface; +import java.net.StandardSocketOptions; import org.jboss.netty.channel.ChannelConfig; import org.jboss.netty.channel.FixedReceiveBufferSizePredictor; @@ -49,9 +49,11 @@ import org.jboss.netty.channel.ReceiveBufferSizePredictorFactory; * * {@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)} * - * {@code "receiveBufferSizePredictor"}{@link #setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)} + * {@code "receiveBufferSizePredictor"} + * {@link #setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)} * - * {@code "receiveBufferSizePredictorFactory"}{@link #setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory)} + * {@code "receiveBufferSizePredictorFactory"} + * {@link #setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory)} * * {@code "sendBufferSize"}{@link #setSendBufferSize(int)} * @@ -64,64 +66,62 @@ import org.jboss.netty.channel.ReceiveBufferSizePredictorFactory; public interface DatagramChannelConfig extends ChannelConfig { /** - * Gets the {@code SO_SNDBUF} option. + * Gets the {@link StandardSocketOptions#SO_SNDBUF} option. */ int getSendBufferSize(); /** - * Sets the {@code SO_SNDBUF} option. + * Sets the {@link StandardSocketOptions#SO_SNDBUF} option. */ void setSendBufferSize(int sendBufferSize); /** - * Gets the {@code SO_RCVBUF} option. + * Gets the {@link StandardSocketOptions#SO_RCVBUF} option. */ int getReceiveBufferSize(); /** - * Gets the {@code SO_RCVBUF} option. + * Sets the {@link StandardSocketOptions#SO_RCVBUF} option. */ void setReceiveBufferSize(int receiveBufferSize); /** - * Gets the traffic class. + * Gets the {@link StandardSocketOptions#IP_TOS} option. */ int getTrafficClass(); /** - * Sets the traffic class as specified in {@link DatagramSocket#setTrafficClass(int)}. + * Gets the {@link StandardSocketOptions#IP_TOS} option. */ void setTrafficClass(int trafficClass); /** - * Gets the {@code SO_REUSEADDR} option. + * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ boolean isReuseAddress(); /** - * Sets the {@code SO_REUSEADDR} option. + * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ void setReuseAddress(boolean reuseAddress); /** - * Gets the {@code SO_BROADCAST} option. + * Gets the {@link StandardSocketOptions#SO_BROADCAST} option. */ boolean isBroadcast(); /** - * Sets the {@code SO_BROADCAST} option. + * Sets the {@link StandardSocketOptions#SO_BROADCAST} option. */ void setBroadcast(boolean broadcast); /** - * Gets the setting for local loopback of multicast datagrams. - * - * @return {@code true} if and only if the loopback mode has been disabled + * Gets the {@link StandardSocketOptions#IP_MULTICAST_LOOP} option. */ boolean isLoopbackModeDisabled(); /** - * Sets the setting for local loopback of multicast datagrams. + * Sets the {@link StandardSocketOptions#IP_MULTICAST_LOOP} option. * * @param loopbackModeDisabled * {@code true} if and only if the loopback mode has been disabled @@ -129,14 +129,12 @@ public interface DatagramChannelConfig extends ChannelConfig { void setLoopbackModeDisabled(boolean loopbackModeDisabled); /** - * Gets the default time-to-live for multicast packets sent out on the - * socket. + * Gets the {@link StandardSocketOptions#IP_MULTICAST_TTL} option. */ int getTimeToLive(); /** - * Sets the default time-to-live for multicast packets sent out on the - * {@link DatagramChannel} in order to control the scope of the multicasts. + * Sets the {@link StandardSocketOptions#IP_MULTICAST_TTL} option. */ void setTimeToLive(int ttl); @@ -151,14 +149,12 @@ public interface DatagramChannelConfig extends ChannelConfig { void setInterface(InetAddress interfaceAddress); /** - * Gets the network interface for outgoing multicast datagrams sent on - * the {@link DatagramChannel}. + * Gets the {@link StandardSocketOptions#IP_MULTICAST_IF} option. */ NetworkInterface getNetworkInterface(); /** - * Sets the network interface for outgoing multicast datagrams sent on - * the {@link DatagramChannel}. + * Sets the {@link StandardSocketOptions#IP_MULTICAST_IF} option. */ void setNetworkInterface(NetworkInterface networkInterface); diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java index 54a32d5fb4..cdae6dea9a 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java @@ -16,6 +16,7 @@ package org.jboss.netty.channel.socket; import java.net.ServerSocket; +import java.net.StandardSocketOptions; import org.jboss.netty.channel.ChannelConfig; @@ -55,22 +56,22 @@ public interface ServerSocketChannelConfig extends ChannelConfig { void setBacklog(int backlog); /** - * Gets the {@code SO_REUSEADDR} option. + * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ boolean isReuseAddress(); /** - * Sets the {@code SO_REUSEADDR} option. + * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ void setReuseAddress(boolean reuseAddress); /** - * Gets the {@code SO_RCVBUF} option. + * Gets the {@link StandardSocketOptions#SO_RCVBUF} option. */ int getReceiveBufferSize(); /** - * Sets the {@code SO_RCVBUF} option. + * Sets the {@link StandardSocketOptions#SO_RCVBUF} option. */ void setReceiveBufferSize(int receiveBufferSize); diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java index 05498b7f40..8064c12de0 100644 --- a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java @@ -16,6 +16,7 @@ package org.jboss.netty.channel.socket; import java.net.Socket; +import java.net.StandardSocketOptions; import org.jboss.netty.channel.ChannelConfig; @@ -50,72 +51,72 @@ import org.jboss.netty.channel.ChannelConfig; public interface SocketChannelConfig extends ChannelConfig { /** - * Gets the {@code SO_TCPNODELAY} option. + * Gets the {@link StandardSocketOptions#TCP_NODELAY} option. */ boolean isTcpNoDelay(); /** - * Sets the {@code SO_TCPNODELAY} option. + * Sets the {@link StandardSocketOptions#TCP_NODELAY} option. */ void setTcpNoDelay(boolean tcpNoDelay); /** - * Gets the {@code SO_LINGER} option. + * Gets the {@link StandardSocketOptions#SO_LINGER} option. */ int getSoLinger(); /** - * Sets the {@code SO_LINGER} option. + * Sets the {@link StandardSocketOptions#SO_LINGER} option. */ void setSoLinger(int soLinger); /** - * Gets the {@code SO_SNDBUF} option. + * Gets the {@link StandardSocketOptions#SO_SNDBUF} option. */ int getSendBufferSize(); /** - * Sets the {@code SO_SNDBUF} option. + * Sets the {@link StandardSocketOptions#SO_SNDBUF} option. */ void setSendBufferSize(int sendBufferSize); /** - * Gets the {@code SO_RCVBUF} option. + * Gets the {@link StandardSocketOptions#SO_RCVBUF} option. */ int getReceiveBufferSize(); /** - * Gets the {@code SO_RCVBUF} option. + * Sets the {@link StandardSocketOptions#SO_RCVBUF} option. */ void setReceiveBufferSize(int receiveBufferSize); /** - * Gets the {@code SO_KEEPALIVE} option. + * Gets the {@link StandardSocketOptions#SO_KEEPALIVE} option. */ boolean isKeepAlive(); /** - * Sets the {@code SO_KEEPALIVE} option. + * Sets the {@link StandardSocketOptions#SO_KEEPALIVE} option. */ void setKeepAlive(boolean keepAlive); /** - * Gets the traffic class. + * Gets the {@link StandardSocketOptions#IP_TOS} option. */ int getTrafficClass(); /** - * Sets the traffic class as specified in {@link Socket#setTrafficClass(int)}. + * Sets the {@link StandardSocketOptions#IP_TOS} option. */ void setTrafficClass(int trafficClass); /** - * Gets the {@code SO_REUSEADDR} option. + * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ boolean isReuseAddress(); /** - * Sets the {@code SO_REUSEADDR} option. + * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option. */ void setReuseAddress(boolean reuseAddress); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannel.java index be7fbbd4e1..e88eff5059 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannel.java @@ -100,7 +100,9 @@ abstract class AbstractNioChannel implements WorkerPool , ExternalResourceReleasable { +public abstract class AbstractNioWorkerPool + implements WorkerPool, ExternalResourceReleasable { private final AbstractNioWorker[] workers; private final AtomicInteger workerIndex = new AtomicInteger(); @@ -39,7 +39,8 @@ public abstract class AbstractNioWorkerPool impleme * Create a new instance * * @param workerExecutor the {@link Executor} to use for the {@link Worker}'s - * @param allowShutdownOnIdle allow the {@link Worker}'s to shutdown when there is not {@link Channel} is registered with it + * @param allowShutdownOnIdle allow the {@link Worker}'s to shutdown when there is not + * {@link Channel} is registered with it * @param workerCount the count of {@link Worker}'s to create */ AbstractNioWorkerPool(Executor workerExecutor, int workerCount, boolean allowShutDownOnIdle) { @@ -65,7 +66,8 @@ public abstract class AbstractNioWorkerPool impleme * * * @param executor the {@link Executor} to use - * @param allowShutdownOnIdle allow the {@link Worker} to shutdown when there is not {@link Channel} is registered with it + * @param allowShutdownOnIdle allow the {@link Worker} to shutdown when there is not + * {@link Channel} is registered with it * @return worker the new {@link Worker} */ protected abstract E createWorker(Executor executor, boolean allowShutdownOnIdle); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java index 0bb3ff13c8..406906efb6 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java @@ -88,7 +88,8 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory private final NioClientSocketPipelineSink sink; /** - * Creates a new {@link NioClientSocketChannelFactory} which uses {@link Executors#newCachedThreadPool()} for the worker and boss executors. + * Creates a new {@link NioClientSocketChannelFactory} which uses {@link Executors#newCachedThreadPool()} + * for the worker and boss executors. * * See {@link #NioClientSocketChannelFactory(Executor, Executor)} */ diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java index 0eeec0b834..bdc637b281 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java @@ -130,7 +130,8 @@ public final class NioDatagramChannel extends AbstractNioChannel workerPool) { this(workerPool, null); @@ -186,7 +187,8 @@ public class NioDatagramChannelFactory implements DatagramChannelFactory { * Creates a new instance. * * @param workerPool - * the {@link WorkerPool} which will be used to obtain the {@link Worker} that execute the I/O worker threads + * the {@link WorkerPool} which will be used to obtain the {@link Worker} that execute + * the I/O worker threads * @param family * the {@link InternetProtocolFamily} to use. This should be used for UDP multicast. * Be aware that this option is only considered when running on java7+ diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java index 589899c372..5a108af50c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java @@ -38,8 +38,9 @@ class NioDatagramPipelineSink extends AbstractNioChannelSink { private final WorkerPool workerPool; /** - * Creates a new {@link NioDatagramPipelineSink} with a the number of {@link NioDatagramWorker}s specified in workerCount. - * The {@link NioDatagramWorker}s take care of reading and writing for the {@link NioDatagramChannel}. + * Creates a new {@link NioDatagramPipelineSink} with a the number of {@link NioDatagramWorker}s + * specified in workerCount. The {@link NioDatagramWorker}s take care of reading and writing + * for the {@link NioDatagramChannel}. * * @param workerExecutor * the {@link Executor} that will run the {@link NioDatagramWorker}s diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java index b18825d9ca..cca91c0647 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java @@ -90,7 +90,8 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory private final ChannelSink sink; /** - * Create a new {@link NioServerSocketChannelFactory} using {@link Executors#newCachedThreadPool()} for the boss and worker. + * Create a new {@link NioServerSocketChannelFactory} using {@link Executors#newCachedThreadPool()} + * for the boss and worker. * * See {@link #NioServerSocketChannelFactory(Executor, Executor)} */ @@ -136,7 +137,8 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory * @param bossExecutor * the {@link Executor} which will execute the boss threads * @param workerPool - * the {@link WorkerPool} which will be used to obtain the {@link NioWorker} that execute the I/O worker threads + * the {@link WorkerPool} which will be used to obtain the {@link NioWorker} that execute + * the I/O worker threads */ public NioServerSocketChannelFactory( Executor bossExecutor, WorkerPool workerPool) { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java index 8d08e1328e..343ddc0dcc 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java @@ -42,9 +42,11 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; * * {@code "writeSpinCount"}{@link #setWriteSpinCount(int)} * - * {@code "receiveBufferSizePredictor"}{@link #setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)} + * {@code "receiveBufferSizePredictor"} + * {@link #setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)} * - * {@code "receiveBufferSizePredictorFactory"}{@link #setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory)} + * {@code "receiveBufferSizePredictorFactory"} + * {@link #setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory)} * * */ diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/ShareableWorkerPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/ShareableWorkerPool.java index 192a23feaa..e7ced7207b 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/ShareableWorkerPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/ShareableWorkerPool.java @@ -19,8 +19,9 @@ import org.jboss.netty.channel.socket.Worker; import org.jboss.netty.util.ExternalResourceReleasable; /** - * This implementation of a {@link WorkerPool} should be used if you plan to share a {@link WorkerPool} between different Factories. You will need to call {@link #destroy()} by your own once - * you want to release any resources of it. + * This implementation of a {@link WorkerPool} should be used if you plan to share a + * {@link WorkerPool} between different Factories. You will need to call {@link #destroy()} by your + * own once you want to release any resources of it. * * */ diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index ea7efa5d3c..7924bc7a7f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -27,7 +27,6 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.CompositeChannelBuffer; import org.jboss.netty.channel.DefaultFileRegion; import org.jboss.netty.channel.FileRegion; -import org.jboss.netty.util.internal.DetectionUtil; final class SocketSendBufferPool { @@ -368,7 +367,8 @@ final class SocketSendBufferPool { public void release() { if (file instanceof DefaultFileRegion) { if (((DefaultFileRegion) file).releaseAfterTransfer()) { - // Make sure the FileRegion resource are released otherwise it may cause a FD leak or something similar + // Make sure the FileRegion resource are released otherwise it may cause a FD + // leak or something similar file.releaseExternalResources(); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioWorker.java index 5cae6e4cbd..d5d85fe6f2 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioWorker.java @@ -134,10 +134,12 @@ abstract class AbstractOioWorker implements Worker /** - * Process the incoming messages and also is responsible for call {@link Channels#fireMessageReceived(Channel, Object)} once a message - * was processed without errors. + * Process the incoming messages and also is responsible for call + * {@link Channels#fireMessageReceived(Channel, Object)} once a message was processed without + * errors. * - * @return continue returns true as long as this worker should continue to try processing incoming messages + * @return continue returns true as long as this worker should continue to try + * processing incoming messages * @throws IOException */ abstract boolean process() throws IOException; diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java index 405f60e3fc..2e74fe4e16 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java @@ -91,7 +91,8 @@ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory private final ChannelSink sink; /** - * Create a new {@link OioServerSocketChannelFactory} with a {@link Executors#newCachedThreadPool()} for the boss and worker executor. + * Create a new {@link OioServerSocketChannelFactory} with a {@link Executors#newCachedThreadPool()} + * for the boss and worker executor. * * See {@link #OioServerSocketChannelFactory(Executor, Executor)} */ diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java index 1d3cc8c685..78b5512d9c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java @@ -94,8 +94,8 @@ class OioWorker extends AbstractOioWorker { try { int length = 0; - // Add support to write a FileRegion. This in fact will not give any performance gain but at least it not fail and - // we did the best to emulate it + // Add support to write a FileRegion. This in fact will not give any performance gain + // but at least it not fail and we did the best to emulate it if (message instanceof FileRegion) { FileRegion fr = (FileRegion) message; try { diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index 55d4f5c135..1431438054 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -415,8 +415,8 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { } /** - * Returns if the {@link ChannelFuture}'s of the {@link ChannelEventRunnable}'s should be notified about the shutdown of this {@link MemoryAwareThreadPoolExecutor}. - * + * Returns if the {@link ChannelFuture}'s of the {@link ChannelEventRunnable}'s should be + * notified about the shutdown of this {@link MemoryAwareThreadPoolExecutor}. */ public boolean getNotifyChannelFuturesOnShutdown() { return notifyOnShutdown; diff --git a/src/main/java/org/jboss/netty/util/internal/QueueFactory.java b/src/main/java/org/jboss/netty/util/internal/QueueFactory.java index b08029a71b..6dfe83a39e 100644 --- a/src/main/java/org/jboss/netty/util/internal/QueueFactory.java +++ b/src/main/java/org/jboss/netty/util/internal/QueueFactory.java @@ -55,8 +55,9 @@ public final class QueueFactory { } catch (Throwable t) { // For whatever reason an exception was thrown while loading the LinkedTransferQueue // - // This mostly happens because of a custom classloader or security policy that did not allow us to access the - // com.sun.Unmisc class. So just log it and fallback to the old LegacyLinkedTransferQueue that works in all cases + // This mostly happens because of a custom classloader or security policy that did not + // allow us to access the com.sun.Unmisc class. So just log it and fallback to the old + // LegacyLinkedTransferQueue that works in all cases if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unable to instance LinkedTransferQueue, fallback to LegacyLinkedTransferQueue", t); } @@ -87,8 +88,9 @@ public final class QueueFactory { } catch (Throwable t) { // For whatever reason an exception was thrown while loading the LinkedTransferQueue // - // This mostly happens because of a custom classloader or security policy that did not allow us to access the - // com.sun.Unmisc class. So just log it and fallback to the old LegacyLinkedTransferQueue that works in all cases + // This mostly happens because of a custom classloader or security policy that did not + // allow us to access the com.sun.Unmisc class. So just log it and fallback to the old + // LegacyLinkedTransferQueue that works in all cases if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unable to instance LinkedTransferQueue, fallback to LegacyLinkedTransferQueue", t); }