*
* @return a future object which notifies when this bind attempt
diff --git a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java
index 1355758361..4f27cd37fb 100644
--- a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java
+++ b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java
@@ -52,7 +52,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public void writerIndex(int writerIndex) {
if (writerIndex < readerIndex || writerIndex > capacity()) {
- throw new IndexOutOfBoundsException("Invalid readerIndex: "
+ throw new IndexOutOfBoundsException("Invalid readerIndex: "
+ readerIndex + " - Maximum is " + writerIndex);
}
this.writerIndex = writerIndex;
@@ -60,7 +60,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public void setIndex(int readerIndex, int writerIndex) {
if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) {
- throw new IndexOutOfBoundsException("Invalid writerIndex: "
+ throw new IndexOutOfBoundsException("Invalid writerIndex: "
+ writerIndex + " - Maximum is " + readerIndex + " or " + capacity());
}
this.readerIndex = readerIndex;
@@ -116,7 +116,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public void ensureWritableBytes(int writableBytes) {
if (writableBytes > writableBytes()) {
- throw new IndexOutOfBoundsException("Writable bytes exceeded: Got "
+ throw new IndexOutOfBoundsException("Writable bytes exceeded: Got "
+ writableBytes + ", maximum is " + writableBytes());
}
}
diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java
index c7420dfab5..e51f9f6092 100644
--- a/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java
+++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java
@@ -189,7 +189,7 @@ public class ChannelBufferInputStream extends InputStream implements DataInput {
lineBuf.setLength(lineBuf.length() - 1);
}
}
-
+
return lineBuf.toString();
}
@@ -227,7 +227,7 @@ public class ChannelBufferInputStream extends InputStream implements DataInput {
throw new IndexOutOfBoundsException("fieldSize cannot be a negative number");
}
if (fieldSize > available()) {
- throw new EOFException("fieldSize is too long! Length is " + fieldSize
+ throw new EOFException("fieldSize is too long! Length is " + fieldSize
+ ", but maximum is " + available());
}
}
diff --git a/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java
index 2a55a0f381..cd605ceaca 100644
--- a/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java
+++ b/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java
@@ -216,7 +216,7 @@ public class CompositeChannelBuffer extends AbstractChannelBuffer {
int componentId = componentId(index);
if (index > capacity() - length || dstIndex > dst.length - length) {
throw new IndexOutOfBoundsException("Too many bytes to read - Needs "
- + (index + length) + ", maximum is " + capacity() + " or "
+ + (index + length) + ", maximum is " + capacity() + " or "
+ dst.length);
}
@@ -286,7 +286,7 @@ public class CompositeChannelBuffer extends AbstractChannelBuffer {
if (DetectionUtil.javaVersion() >= 7) {
return (int) out.write(toByteBuffers(index, length));
}
-
+
// XXX Gathering write is not supported because of a known issue.
// See http://bugs.sun.com/view_bug.do?bug_id=6210541
// This issue appeared in 2004 and is still unresolved!?
@@ -297,7 +297,7 @@ public class CompositeChannelBuffer extends AbstractChannelBuffer {
throws IOException {
int componentId = componentId(index);
if (index > capacity() - length) {
- throw new IndexOutOfBoundsException("Too many bytes to be read - needs "
+ throw new IndexOutOfBoundsException("Too many bytes to be read - needs "
+ (index + length) + ", maximum of " + capacity());
}
@@ -647,9 +647,9 @@ public class CompositeChannelBuffer extends AbstractChannelBuffer {
final int bytesToMove = capacity() - localReaderIndex;
List list = decompose(localReaderIndex, bytesToMove);
-
+
// If the list is empty we need to assign a new one because
- // we get a List that is immutable.
+ // we get a List that is immutable.
//
// See https://github.com/netty/netty/issues/325
if (list.isEmpty()) {
diff --git a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java
index 420debf594..0a8f904587 100644
--- a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java
+++ b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java
@@ -73,8 +73,8 @@ public class DynamicChannelBuffer extends AbstractChannelBuffer {
int minNewCapacity = writerIndex() + minWritableBytes;
while (newCapacity < minNewCapacity) {
newCapacity <<= 1;
-
- // Check if we exceeded the maximum size of 2gb if this is the case then
+
+ // Check if we exceeded the maximum size of 2gb if this is the case then
// newCapacity == 0
//
// https://github.com/netty/netty/issues/258
diff --git a/src/main/java/org/jboss/netty/channel/Channel.java b/src/main/java/org/jboss/netty/channel/Channel.java
index b127bebad4..72da5f9279 100644
--- a/src/main/java/org/jboss/netty/channel/Channel.java
+++ b/src/main/java/org/jboss/netty/channel/Channel.java
@@ -359,11 +359,11 @@ public interface Channel extends Comparable {
* {@code interestOps} change request succeeds or fails
*/
ChannelFuture setReadable(boolean readable);
-
+
/**
* Retrieves an object which is {@link #setAttachment(Object) attached} to
* this {@link Channel}.
- *
+ *
* @return {@code null} if no object was attached or {@code null} was
* attached
*/
diff --git a/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java b/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java
index ab431fe50f..44015f2c35 100644
--- a/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java
+++ b/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java
@@ -57,7 +57,7 @@ package org.jboss.netty.channel;
* You will also find various helper methods in {@link Channels} to be useful
* to generate and send an artificial or manipulated event.
*
- * Caution:
+ * Caution:
*
* Use the *Later(..) methods of the {@link Channels} class if you want to send an upstream event from a {@link ChannelDownstreamHandler} otherwise you may run into threading issues.
*
diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java
index d24bc7692b..ee424eb072 100644
--- a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java
+++ b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java
@@ -460,7 +460,7 @@ public interface ChannelPipeline {
* with this pipeline's {@link Channel}.
*/
ChannelFuture execute(Runnable task);
-
+
/**
* Returns the {@link Channel} that this pipeline is attached to.
*
diff --git a/src/main/java/org/jboss/netty/channel/ChannelSink.java b/src/main/java/org/jboss/netty/channel/ChannelSink.java
index fe1f6ce5e0..fecd773d3d 100644
--- a/src/main/java/org/jboss/netty/channel/ChannelSink.java
+++ b/src/main/java/org/jboss/netty/channel/ChannelSink.java
@@ -38,7 +38,7 @@ public interface ChannelSink {
* one of its {@link ChannelHandler}s process a {@link ChannelEvent}.
*/
void exceptionCaught(ChannelPipeline pipeline, ChannelEvent e, ChannelPipelineException cause) throws Exception;
-
+
/**
* Execute the given {@link Runnable} later in the io-thread.
* Some implementation may not support this and just execute it directly.
diff --git a/src/main/java/org/jboss/netty/channel/Channels.java b/src/main/java/org/jboss/netty/channel/Channels.java
index c5000b7c3b..bd8c1f771e 100644
--- a/src/main/java/org/jboss/netty/channel/Channels.java
+++ b/src/main/java/org/jboss/netty/channel/Channels.java
@@ -304,15 +304,15 @@ public final class Channels {
*/
public static ChannelFuture fireWriteCompleteLater(final Channel channel, final long amount) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireWriteComplete(channel, amount);
}
});
-
+
}
-
+
/**
* Sends a {@code "writeComplete"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -336,7 +336,7 @@ public final class Channels {
public static void fireWriteComplete(ChannelHandlerContext ctx, long amount) {
ctx.sendUpstream(new DefaultWriteCompletionEvent(ctx.getChannel(), amount));
}
-
+
/**
* Sends a {@code "channelInterestChanged"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -344,14 +344,14 @@ public final class Channels {
*/
public static ChannelFuture fireChannelInterestChangedLater(final Channel channel) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireChannelInterestChanged(channel);
-
+
}
});
}
-
+
/**
* Sends a {@code "channelInterestChanged"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -384,7 +384,7 @@ public final class Channels {
*/
public static ChannelFuture fireChannelDisconnectedLater(final Channel channel) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireChannelDisconnected(channel);
}
@@ -419,14 +419,14 @@ public final class Channels {
*/
public static ChannelFuture fireChannelUnboundLater(final Channel channel) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireChannelUnbound(channel);
}
});
}
-
-
+
+
/**
* Sends a {@code "channelUnbound"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -449,8 +449,8 @@ public final class Channels {
ctx.getChannel(), ChannelState.BOUND, null));
}
-
-
+
+
/**
* Sends a {@code "channelClosed"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -458,15 +458,15 @@ public final class Channels {
*/
public static ChannelFuture fireChannelClosedLater(final Channel channel) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireChannelClosed(channel);
}
});
-
+
}
-
-
+
+
/**
* Sends a {@code "channelClosed"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
@@ -502,7 +502,7 @@ public final class Channels {
*/
public static ChannelFuture fireExceptionCaughtLater(final Channel channel, final Throwable cause) {
return channel.getPipeline().execute(new Runnable() {
-
+
public void run() {
fireExceptionCaught(channel, cause);
}
diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java
index 453987c35c..a1e590ca6f 100644
--- a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java
+++ b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java
@@ -50,7 +50,7 @@ import java.net.SocketAddress;
* }
* }
*
- * Caution:
+ * Caution:
*
* Use the *Later(..) methods of the {@link Channels} class if you want to send an upstream event from a {@link ChannelDownstreamHandler} otherwise you may run into threading issues.
*
diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java
index df0942c2e7..6b86cfcb14 100644
--- a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java
+++ b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java
@@ -146,7 +146,7 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler {
/**
* Invoked when a {@link Channel} is open, but not bound nor connected.
*
- *
+ *
* Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers!
*/
public void channelOpen(
@@ -158,7 +158,7 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler {
* Invoked when a {@link Channel} is open and bound to a local address,
* but not connected.
*
- *
+ *
* Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers!
*/
public void channelBound(
@@ -170,7 +170,7 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler {
* Invoked when a {@link Channel} is open, bound to a local address, and
* connected to a remote address.
*
- *
+ *
* Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers!
*/
public void channelConnected(
diff --git a/src/main/java/org/jboss/netty/channel/socket/ChannelRunnableWrapper.java b/src/main/java/org/jboss/netty/channel/socket/ChannelRunnableWrapper.java
index 323e18429e..caca3e469a 100644
--- a/src/main/java/org/jboss/netty/channel/socket/ChannelRunnableWrapper.java
+++ b/src/main/java/org/jboss/netty/channel/socket/ChannelRunnableWrapper.java
@@ -22,13 +22,13 @@ public class ChannelRunnableWrapper extends DefaultChannelFuture implements Runn
private final Runnable task;
private boolean started;
-
+
public ChannelRunnableWrapper(Channel channel, Runnable task) {
super(channel, true);
this.task = task;
}
-
+
public void run() {
synchronized (this) {
if (!isCancelled()) {
@@ -52,7 +52,7 @@ public class ChannelRunnableWrapper extends DefaultChannelFuture implements Runn
}
return super.cancel();
}
-
-
+
+
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/Worker.java b/src/main/java/org/jboss/netty/channel/socket/Worker.java
index 9e627a99cf..e619d99937 100644
--- a/src/main/java/org/jboss/netty/channel/socket/Worker.java
+++ b/src/main/java/org/jboss/netty/channel/socket/Worker.java
@@ -18,14 +18,14 @@ package org.jboss.netty.channel.socket;
/**
* A {@link Worker} is responsible to dispatch IO operations
- *
+ *
*/
public interface Worker extends Runnable {
/**
* Execute the given {@link Runnable} in the IO-Thread. This may be now or
* later once the IO-Thread do some other work.
- *
+ *
* @param task
* the {@link Runnable} to execute
*/
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannelSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannelSink.java
index 7eadf5b294..894039ae73 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannelSink.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioChannelSink.java
@@ -35,7 +35,7 @@ public abstract class AbstractNioChannelSink extends AbstractChannelSink {
return wrapper;
}
return super.execute(pipeline, task);
-
+
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java
index 3b0176ad47..24c90ccab0 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java
@@ -17,18 +17,6 @@ package org.jboss.netty.channel.socket.nio;
import static org.jboss.netty.channel.Channels.*;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelException;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.socket.Worker;
-import org.jboss.netty.channel.socket.nio.SocketSendBufferPool.SendBuffer;
-import org.jboss.netty.logging.InternalLogger;
-import org.jboss.netty.logging.InternalLoggerFactory;
-import org.jboss.netty.util.ThreadRenamingRunnable;
-import org.jboss.netty.util.internal.DeadLockProofWorker;
-import org.jboss.netty.util.internal.QueueFactory;
-
import java.io.IOException;
import java.nio.channels.AsynchronousCloseException;
import java.nio.channels.CancelledKeyException;
@@ -47,8 +35,20 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelException;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.socket.Worker;
+import org.jboss.netty.channel.socket.nio.SocketSendBufferPool.SendBuffer;
+import org.jboss.netty.logging.InternalLogger;
+import org.jboss.netty.logging.InternalLoggerFactory;
+import org.jboss.netty.util.ThreadRenamingRunnable;
+import org.jboss.netty.util.internal.DeadLockProofWorker;
+import org.jboss.netty.util.internal.QueueFactory;
+
abstract class AbstractNioWorker implements Worker {
-
+
private static final AtomicInteger nextId = new AtomicInteger();
@@ -64,7 +64,7 @@ abstract class AbstractNioWorker implements Worker {
static final int CLEANUP_INTERVAL = 256; // XXX Hard-coded value, but won't need customization.
-
+
/**
* Executor used to execute {@link Runnable}s such as channel registration
* task.
@@ -117,7 +117,7 @@ abstract class AbstractNioWorker implements Worker {
private final Queue eventQueue = QueueFactory.createQueue(Runnable.class);
-
+
private volatile int cancelledKeys; // should use AtomicInteger but we just need approximation
protected final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool();
@@ -132,16 +132,16 @@ abstract class AbstractNioWorker implements Worker {
this.executor = executor;
this.allowShutdownOnIdle = allowShutdownOnIdle;
}
-
+
void register(AbstractNioChannel> channel, ChannelFuture future) {
Runnable registerTask = createRegisterTask(channel, future);
Selector selector = start();
-
+
boolean offered = registerTaskQueue.offer(registerTask);
assert offered;
-
+
if (wakenUp.compareAndSet(false, true)) {
selector.wakeup();
}
@@ -149,7 +149,7 @@ abstract class AbstractNioWorker implements Worker {
/**
* Start the {@link AbstractNioWorker} and return the {@link Selector} that will be used for the {@link AbstractNioChannel}'s when they get registered
- *
+ *
* @return selector
*/
private Selector start() {
@@ -157,7 +157,7 @@ abstract class AbstractNioWorker implements Worker {
if (!started) {
// Open a selector if this worker didn't start yet.
try {
- this.selector = Selector.open();
+ selector = Selector.open();
} catch (Throwable t) {
throw new ChannelException("Failed to create a selector.", t);
}
@@ -175,7 +175,7 @@ abstract class AbstractNioWorker implements Worker {
} catch (Throwable t) {
logger.warn("Failed to close a selector.", t);
}
- this.selector = null;
+ selector = null;
// The method will return to the caller at this point.
}
}
@@ -297,10 +297,10 @@ abstract class AbstractNioWorker implements Worker {
public void executeInIoThread(Runnable task) {
executeInIoThread(task, false);
}
-
+
/**
* Execute the {@link Runnable} in a IO-Thread
- *
+ *
* @param task
* the {@link Runnable} to execute
* @param alwaysAsync
@@ -325,8 +325,8 @@ abstract class AbstractNioWorker implements Worker {
}
}
-
-
+
+
private void processRegisterTaskQueue() throws IOException {
for (;;) {
final Runnable task = registerTaskQueue.poll();
@@ -350,7 +350,7 @@ abstract class AbstractNioWorker implements Worker {
cleanUpCancelledKeys();
}
}
-
+
private void processEventQueue() throws IOException {
for (;;) {
final Runnable task = eventQueue.poll();
@@ -361,7 +361,7 @@ abstract class AbstractNioWorker implements Worker {
cleanUpCancelledKeys();
}
}
-
+
private void processSelectedKeys(Set selectedKeys) throws IOException {
for (Iterator i = selectedKeys.iterator(); i.hasNext();) {
SelectionKey k = i.next();
@@ -395,9 +395,9 @@ abstract class AbstractNioWorker implements Worker {
}
return false;
}
-
-
+
+
private void close(SelectionKey k) {
AbstractNioChannel> ch = (AbstractNioChannel>) k.attachment();
close(ch, succeededFuture(ch));
@@ -431,7 +431,7 @@ abstract class AbstractNioWorker implements Worker {
write0(ch);
}
}
-
+
void writeFromSelectorLoop(final SelectionKey k) {
AbstractNioChannel> ch = (AbstractNioChannel>) k.attachment();
ch.writeSuspended = false;
@@ -552,7 +552,7 @@ abstract class AbstractNioWorker implements Worker {
static boolean isIoThread(AbstractNioChannel> channel) {
return Thread.currentThread() == channel.worker.thread;
}
-
+
protected void setOpWrite(AbstractNioChannel> channel) {
Selector selector = this.selector;
SelectionKey key = channel.channel.keyFor(selector);
@@ -598,13 +598,13 @@ abstract class AbstractNioWorker implements Worker {
}
}
}
-
+
void close(AbstractNioChannel> channel, ChannelFuture future) {
boolean connected = channel.isConnected();
boolean bound = channel.isBound();
boolean iothread = isIoThread(channel);
-
+
try {
channel.channel.close();
cancelledKeys ++;
@@ -688,7 +688,7 @@ abstract class AbstractNioWorker implements Worker {
}
evt.getFuture().setFailure(cause);
-
+
}
}
@@ -714,16 +714,16 @@ abstract class AbstractNioWorker implements Worker {
// Override OP_WRITE flag - a user cannot change this flag.
interestOps &= ~Channel.OP_WRITE;
interestOps |= channel.getRawInterestOps() & Channel.OP_WRITE;
-
+
if (key == null || selector == null) {
if (channel.getRawInterestOps() != interestOps) {
changed = true;
}
-
+
// Not registered to the worker yet.
// Set the rawInterestOps immediately; RegisterTask will pick it up.
channel.setRawInterestOpsNow(interestOps);
-
+
future.setSuccess();
if (changed) {
if (iothread) {
@@ -732,7 +732,7 @@ abstract class AbstractNioWorker implements Worker {
fireChannelInterestChangedLater(channel);
}
}
-
+
return;
}
@@ -802,7 +802,7 @@ abstract class AbstractNioWorker implements Worker {
}
}
}
-
+
/**
* Read is called when a Selector has been notified that the underlying channel
* was something to be read. The channel would previously have registered its interest
@@ -814,11 +814,11 @@ abstract class AbstractNioWorker implements Worker {
/**
* Create a new {@link Runnable} which will register the {@link AbstractNioWorker} with the {@link Channel}
- *
+ *
* @param channel
* @param future
* @return task
*/
protected abstract Runnable createRegisterTask(AbstractNioChannel> channel, ChannelFuture future);
-
+
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorkerPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorkerPool.java
index 621c190fec..3f5a5ef6e9 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorkerPool.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorkerPool.java
@@ -16,14 +16,14 @@
package org.jboss.netty.channel.socket.nio;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.socket.Worker;
import org.jboss.netty.util.ExternalResourceReleasable;
import org.jboss.netty.util.internal.ExecutorUtil;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
* Abstract base class for {@link WorkerPool} implementations that create the {@link Worker}'s up-front and return them in a "fair" fashion when calling
* {@link #nextWorker()}
@@ -34,10 +34,10 @@ public abstract class AbstractNioWorkerPool impleme
private final AbstractNioWorker[] workers;
private final AtomicInteger workerIndex = new AtomicInteger();
private final Executor workerExecutor;
-
+
/**
* 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 workerCount the count of {@link Worker}'s to create
@@ -50,7 +50,7 @@ public abstract class AbstractNioWorkerPool impleme
throw new IllegalArgumentException(
"workerCount (" + workerCount + ") " +
"must be a positive integer.");
- }
+ }
workers = new AbstractNioWorker[workerCount];
for (int i = 0; i < workers.length; i++) {
@@ -62,11 +62,11 @@ public abstract class AbstractNioWorkerPool impleme
/**
* Create a new {@link Worker} which uses the given {@link Executor} to service IO
- *
- *
+ *
+ *
* @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
- * @return worker the new {@link Worker}
+ * @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/NioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java
index fbfff17867..54af40e24b 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java
@@ -15,7 +15,7 @@
*/
package org.jboss.netty.channel.socket.nio;
-import static org.jboss.netty.channel.Channels.fireChannelOpen;
+import static org.jboss.netty.channel.Channels.*;
import java.nio.channels.SocketChannel;
@@ -38,7 +38,7 @@ final class NioAcceptedSocketChannel extends NioSocketChannel {
this.bossThread = bossThread;
setConnected();
-
+
fireChannelOpen(this);
}
}
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 3212654bfe..e870a7232e 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,14 +88,14 @@ 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)}
*/
public NioClientSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
-
+
/**
* Creates a new instance. Calling this constructor is same with calling
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with
@@ -163,7 +163,7 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory
"bossCount (" + bossCount + ") " +
"must be a positive integer.");
}
-
+
this.bossExecutor = bossExecutor;
this.workerPool = workerPool;
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java
index fccaef52bf..c5a44a3b99 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java
@@ -15,18 +15,7 @@
*/
package org.jboss.netty.channel.socket.nio;
-import static org.jboss.netty.channel.Channels.fireChannelDisconnected;
-import static org.jboss.netty.channel.Channels.fireChannelDisconnectedLater;
-import static org.jboss.netty.channel.Channels.fireExceptionCaught;
-import static org.jboss.netty.channel.Channels.fireExceptionCaughtLater;
-import static org.jboss.netty.channel.Channels.fireMessageReceived;
-import static org.jboss.netty.channel.Channels.succeededFuture;
-import org.jboss.netty.buffer.ChannelBufferFactory;
-import org.jboss.netty.channel.ChannelException;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.ReceiveBufferSizePredictor;
+import static org.jboss.netty.channel.Channels.*;
import java.io.IOException;
import java.net.SocketAddress;
@@ -39,6 +28,13 @@ import java.nio.channels.Selector;
import java.util.Queue;
import java.util.concurrent.Executor;
+import org.jboss.netty.buffer.ChannelBufferFactory;
+import org.jboss.netty.channel.ChannelException;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.ReceiveBufferSizePredictor;
+
/**
* A class responsible for registering channels with {@link Selector}.
* It also implements the {@link Selector} loop.
@@ -58,7 +54,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
NioDatagramWorker(final Executor executor, boolean allowShutdownOnIdle) {
super(executor, allowShutdownOnIdle);
}
-
+
@Override
protected boolean read(final SelectionKey key) {
final NioDatagramChannel channel = (NioDatagramChannel) key.attachment();
@@ -110,7 +106,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
return true;
}
-
+
@Override
protected boolean scheduleWriteIfNecessary(final AbstractNioChannel> channel) {
@@ -163,7 +159,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
protected Runnable createRegisterTask(AbstractNioChannel> channel, ChannelFuture future) {
return new ChannelRegistionTask((NioDatagramChannel) channel, future);
}
-
+
/**
* RegisterTask is a task responsible for registering a channel with a
* selector.
@@ -206,7 +202,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
future.setFailure(e);
}
close(channel, succeededFuture(channel));
-
+
if (!(e instanceof ClosedChannelException)) {
throw new ChannelException(
"Failed to register a socket to the selector.", e);
@@ -214,7 +210,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
}
}
}
-
+
@Override
public void writeFromUserCode(final AbstractNioChannel> channel) {
/*
@@ -243,7 +239,7 @@ public class NioDatagramWorker extends AbstractNioWorker {
write0(channel);
}
-
+
@Override
protected void write0(final AbstractNioChannel> channel) {
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorkerPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorkerPool.java
index 87c3ef4d42..af71d9ec0b 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorkerPool.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorkerPool.java
@@ -20,7 +20,7 @@ import java.util.concurrent.Executor;
/**
* Default implementation which hands of {@link NioDatagramWorker}'s
- *
+ *
*
*/
public class NioDatagramWorkerPool extends AbstractNioWorkerPool {
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 28109b1aec..da210b36b0 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,14 +90,14 @@ 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)}
*/
public NioServerSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
-
+
/**
* Creates a new instance. Calling this constructor is same with calling
* {@link #NioServerSocketChannelFactory(Executor, Executor, int)} with 2 *
@@ -146,7 +146,7 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory
if (workerPool == null) {
throw new NullPointerException("workerPool");
}
-
+
this.bossExecutor = bossExecutor;
this.workerPool = workerPool;
sink = new NioServerSocketPipelineSink(workerPool);
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java
index 427505fe79..f24996acdd 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java
@@ -15,16 +15,7 @@
*/
package org.jboss.netty.channel.socket.nio;
-import static org.jboss.netty.channel.Channels.fireChannelBound;
-import static org.jboss.netty.channel.Channels.fireChannelConnected;
-import static org.jboss.netty.channel.Channels.fireExceptionCaught;
-import static org.jboss.netty.channel.Channels.fireMessageReceived;
-import static org.jboss.netty.channel.Channels.succeededFuture;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBufferFactory;
-import org.jboss.netty.channel.ChannelException;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ReceiveBufferSizePredictor;
+import static org.jboss.netty.channel.Channels.*;
import java.io.IOException;
import java.net.SocketAddress;
@@ -35,6 +26,12 @@ import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.concurrent.Executor;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferFactory;
+import org.jboss.netty.channel.ChannelException;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ReceiveBufferSizePredictor;
+
public class NioWorker extends AbstractNioWorker {
private final SocketReceiveBufferPool recvBufferPool = new SocketReceiveBufferPool();
@@ -42,7 +39,7 @@ public class NioWorker extends AbstractNioWorker {
public NioWorker(Executor executor) {
super(executor);
}
-
+
public NioWorker(Executor executor, boolean allowShutdownOnIdle) {
super(executor, allowShutdownOnIdle);
}
@@ -141,13 +138,13 @@ public class NioWorker extends AbstractNioWorker {
return false;
}
-
+
@Override
protected Runnable createRegisterTask(AbstractNioChannel> channel, ChannelFuture future) {
boolean server = !(channel instanceof NioClientSocketChannel);
return new RegisterTask((NioSocketChannel) channel, future, server);
}
-
+
private final class RegisterTask implements Runnable {
private final NioSocketChannel channel;
private final ChannelFuture future;
@@ -186,7 +183,7 @@ public class NioWorker extends AbstractNioWorker {
channel.setConnected();
future.setSuccess();
}
-
+
if (server || !((NioClientSocketChannel) channel).boundManually) {
fireChannelBound(channel, localAddress);
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorkerPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorkerPool.java
index be15bb469b..7e9f67a1dc 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorkerPool.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorkerPool.java
@@ -20,7 +20,7 @@ import java.util.concurrent.Executor;
/**
* Default implementation which hands of {@link NioWorker}'s
- *
+ *
*
*/
public class NioWorkerPool extends AbstractNioWorkerPool {
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 114d151f7b..64f96b9ad6 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
@@ -21,8 +21,8 @@ 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.
- *
- *
+ *
+ *
*/
public final class ShareableWorkerPool implements WorkerPool {
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 d439e90a22..464c92df6d 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
@@ -72,7 +72,7 @@ final class SocketSendBufferPool {
if (src instanceof CompositeChannelBuffer && DetectionUtil.javaVersion() >= 7) {
return new GatheringSendBuffer(src.toByteBuffers());
}
-
+
if (src.isDirect()) {
return new UnpooledSendBuffer(src.toByteBuffer());
}
@@ -257,7 +257,7 @@ final class SocketSendBufferPool {
}
}
}
-
+
class GatheringSendBuffer implements SendBuffer {
private final ByteBuffer[] buffers;
@@ -267,14 +267,14 @@ final class SocketSendBufferPool {
GatheringSendBuffer(ByteBuffer[] buffers) {
this.buffers = buffers;
- this.last = buffers.length - 1;
+ last = buffers.length - 1;
int total = 0;
for (ByteBuffer buf: buffers) {
total += buf.remaining();
}
this.total = total;
}
-
+
public boolean finished() {
return !buffers[last].hasRemaining();
}
@@ -329,7 +329,7 @@ final class SocketSendBufferPool {
public void release() {
// nothing todo
}
-
+
}
final class FileSendBuffer implements SendBuffer {
diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/WorkerPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/WorkerPool.java
index 21a5681548..bf444576e5 100644
--- a/src/main/java/org/jboss/netty/channel/socket/nio/WorkerPool.java
+++ b/src/main/java/org/jboss/netty/channel/socket/nio/WorkerPool.java
@@ -26,10 +26,10 @@ public interface WorkerPool {
/**
* Return the next {@link Worker} to use
- *
+ *
* @return worker
*/
E nextWorker();
-
+
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioChannelSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioChannelSink.java
index 1eb70b9e71..456dcf4e93 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioChannelSink.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/AbstractOioChannelSink.java
@@ -37,10 +37,10 @@ public abstract class AbstractOioChannelSink extends AbstractChannelSink {
channel.worker.executeInIoThread(wrapper);
return wrapper;
}
- }
-
+ }
+
return super.execute(pipeline, task);
-
+
}
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 8b3187f6f2..bc6ec6f672 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
@@ -16,15 +16,16 @@
package org.jboss.netty.channel.socket.oio;
import static org.jboss.netty.channel.Channels.*;
+
+import java.io.IOException;
+import java.util.Queue;
+
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.socket.Worker;
import org.jboss.netty.util.internal.QueueFactory;
-import java.io.IOException;
-import java.util.Queue;
-
/**
* Abstract base class for Oio-Worker implementations
*
@@ -33,7 +34,7 @@ import java.util.Queue;
abstract class AbstractOioWorker implements Worker {
private final Queue eventQueue = QueueFactory.createQueue(Runnable.class);
-
+
protected final C channel;
/**
@@ -41,15 +42,15 @@ abstract class AbstractOioWorker implements Worker
* used when starting. i.e. the current thread when the run method is executed.
*/
protected volatile Thread thread;
-
+
private volatile boolean done;
-
+
public AbstractOioWorker(C channel) {
this.channel = channel;
channel.worker = this;
}
-
+
public void run() {
thread = channel.workerThread = Thread.currentThread();
@@ -67,7 +68,7 @@ abstract class AbstractOioWorker implements Worker
}
}
}
-
+
boolean cont = false;
try {
cont = process();
@@ -77,7 +78,7 @@ abstract class AbstractOioWorker implements Worker
}
} finally {
processEventQueue();
-
+
if (!cont) {
break;
}
@@ -90,37 +91,37 @@ abstract class AbstractOioWorker implements Worker
// Clean up.
close(channel, succeededFuture(channel), true);
-
+
// Mark the worker event loop as done so we know that we need to run tasks directly and not queue them
// See #287
done = true;
-
+
// just to make we don't have something left
processEventQueue();
}
-
+
static boolean isIoThread(AbstractOioChannel channel) {
return Thread.currentThread() == channel.workerThread;
}
-
-
+
+
public void executeInIoThread(Runnable task) {
// check if the current thread is the worker thread
//
- // Also check if the event loop of the worker is complete. If so we need to run the task now.
+ // Also check if the event loop of the worker is complete. If so we need to run the task now.
// See #287
if (Thread.currentThread() == thread || done) {
task.run();
} else {
boolean added = eventQueue.offer(task);
-
+
if (added) {
// as we set the SO_TIMEOUT to 1 second this task will get picked up in 1 second at latest
}
}
}
-
+
private void processEventQueue() {
for (;;) {
final Runnable task = eventQueue.poll();
@@ -130,21 +131,21 @@ abstract class AbstractOioWorker implements Worker
task.run();
}
}
-
+
/**
* Process the incoming messages and also is responsible for call {@link Channels#fireMessageReceived(Channel, Object)} once a message
- * was processed without errors.
- *
+ * was processed without errors.
+ *
* @return continue returns true as long as this worker should continue to try processing incoming messages
* @throws IOException
*/
abstract boolean process() throws IOException;
-
+
static void setInterestOps(
AbstractOioChannel channel, ChannelFuture future, int interestOps) {
boolean iothread = isIoThread(channel);
-
+
// Override OP_WRITE flag - a user cannot change this flag.
interestOps &= ~Channel.OP_WRITE;
interestOps |= channel.getInterestOps() & Channel.OP_WRITE;
@@ -187,15 +188,15 @@ abstract class AbstractOioWorker implements Worker
}
}
}
-
+
static void close(AbstractOioChannel channel, ChannelFuture future) {
close(channel, future, isIoThread(channel));
}
-
+
private static void close(AbstractOioChannel channel, ChannelFuture future, boolean iothread) {
boolean connected = channel.isConnected();
boolean bound = channel.isBound();
-
+
try {
channel.closeSocket();
if (channel.setClosed()) {
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java
index 5f91e6b97e..cd278e9e24 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java
@@ -15,8 +15,7 @@
*/
package org.jboss.netty.channel.socket.oio;
-import static org.jboss.netty.channel.Channels.fireChannelBound;
-import static org.jboss.netty.channel.Channels.fireChannelOpen;
+import static org.jboss.netty.channel.Channels.*;
import java.io.IOException;
import java.io.OutputStream;
@@ -53,7 +52,7 @@ class OioAcceptedSocketChannel extends OioSocketChannel {
} catch (IOException e) {
throw new ChannelException("Failed to obtain an OutputStream.", e);
}
-
+
fireChannelOpen(this);
fireChannelBound(this, getLocalAddress());
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java
index 75eeb485c3..d00af816b6 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java
@@ -78,14 +78,14 @@ public class OioClientSocketChannelFactory implements ClientSocketChannelFactory
final OioClientSocketPipelineSink sink;
/**
- * Creates a new instance with a {@link Executors#newCachedThreadPool()} as worker executor.
- *
+ * Creates a new instance with a {@link Executors#newCachedThreadPool()} as worker executor.
+ *
* See {@link #OioClientSocketChannelFactory(Executor)}
*/
public OioClientSocketChannelFactory() {
this(Executors.newCachedThreadPool());
}
-
+
/**
* Creates a new instance.
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java
index 00231693f7..2ac95c9106 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java
@@ -61,7 +61,7 @@ final class OioDatagramChannel extends AbstractOioChannel
"Failed to configure the datagram socket timeout.", e);
}
config = new DefaultDatagramChannelConfig(socket);
-
+
fireChannelOpen(this);
}
@@ -147,6 +147,6 @@ final class OioDatagramChannel extends AbstractOioChannel
boolean isSocketClosed() {
return socket.isClosed();
}
-
-
+
+
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java
index c3b9eb3230..689d2bff51 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java
@@ -78,13 +78,13 @@ public class OioDatagramChannelFactory implements DatagramChannelFactory {
/**
* Creates a new instance with a {@link Executors#newCachedThreadPool()}
- *
+ *
* See {@link #OioDatagramChannelFactory(Executor)}
*/
public OioDatagramChannelFactory() {
this(Executors.newCachedThreadPool());
}
-
+
/**
* Creates a new instance.
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java
index 2ecc8b0302..da508ae994 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java
@@ -33,7 +33,7 @@ class OioDatagramWorker extends AbstractOioWorker {
super(channel);
}
-
+
@Override
boolean process() throws IOException {
@@ -49,7 +49,7 @@ class OioDatagramWorker extends AbstractOioWorker {
// Can happen on interruption.
// Keep receiving unless the channel is closed.
return true;
- }
+ }
fireMessageReceived(
channel,
@@ -64,7 +64,7 @@ class OioDatagramWorker extends AbstractOioWorker {
OioDatagramChannel channel, ChannelFuture future,
Object message, SocketAddress remoteAddress) {
boolean iothread = isIoThread(channel);
-
+
try {
ChannelBuffer buf = (ChannelBuffer) message;
int offset = buf.readerIndex();
@@ -102,11 +102,11 @@ class OioDatagramWorker extends AbstractOioWorker {
}
}
-
+
static void disconnect(OioDatagramChannel channel, ChannelFuture future) {
boolean connected = channel.isConnected();
boolean iothread = isIoThread(channel);
-
+
try {
channel.socket.disconnect();
future.setSuccess();
diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java
index 4ba50664ac..ef39120979 100644
--- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java
@@ -68,7 +68,7 @@ class OioServerSocketChannel extends AbstractServerChannel
logger.warn(
"Failed to close a partially initialized socket.", e2);
}
-
+
}
throw new ChannelException(
"Failed to set the server socket timeout.", e);
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 11ce5803f5..e8bca7c15b 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
@@ -92,13 +92,13 @@ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory
/**
* Create a new {@link OioServerSocketChannelFactory} with a {@link Executors#newCachedThreadPool()} for the boss and worker executor.
- *
+ *
* See {@link #OioServerSocketChannelFactory(Executor, Executor)}
*/
public OioServerSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
-
+
/**
* Creates a new instance.
*
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 a05f37d676..e89568b005 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
@@ -47,7 +47,7 @@ class OioWorker extends AbstractOioWorker {
// Fire the channelConnected event for OioAcceptedSocketChannel.
// See #287
fireChannelConnected(channel, channel.getRemoteAddress());
-
+
}
super.run();
}
@@ -70,7 +70,7 @@ class OioWorker extends AbstractOioWorker {
return true;
}
fireMessageReceived(channel, channel.getConfig().getBufferFactory().getBuffer(buf, 0, readBytes));
-
+
return true;
}
@@ -94,14 +94,14 @@ 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
+ // 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 {
synchronized (out) {
WritableByteChannel bchannel = Channels.newChannel(out);
-
+
long i = 0;
while ((i = fr.transferTo(bchannel, length)) > 0) {
length += i;
@@ -126,14 +126,14 @@ class OioWorker extends AbstractOioWorker {
a.getBytes(a.readerIndex(), out, length);
}
}
-
+
future.setSuccess();
if (iothread) {
fireWriteComplete(channel, length);
} else {
fireWriteCompleteLater(channel, length);
}
-
+
} catch (Throwable t) {
// Convert 'SocketException: Socket closed' to
// ClosedChannelException.
diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardServer.java b/src/main/java/org/jboss/netty/example/discard/DiscardServer.java
index 6b12314b43..dc245a0521 100644
--- a/src/main/java/org/jboss/netty/example/discard/DiscardServer.java
+++ b/src/main/java/org/jboss/netty/example/discard/DiscardServer.java
@@ -34,7 +34,7 @@ public class DiscardServer {
public DiscardServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
diff --git a/src/main/java/org/jboss/netty/example/echo/EchoServer.java b/src/main/java/org/jboss/netty/example/echo/EchoServer.java
index 5bf0153efa..9ecd55c292 100644
--- a/src/main/java/org/jboss/netty/example/echo/EchoServer.java
+++ b/src/main/java/org/jboss/netty/example/echo/EchoServer.java
@@ -30,11 +30,11 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
public class EchoServer {
private final int port;
-
+
public EchoServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java b/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java
index 95dc08d863..6872d7f7fd 100644
--- a/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java
+++ b/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java
@@ -32,7 +32,7 @@ public class FactorialClient {
private final String host;
private final int port;
private final int count;
-
+
public FactorialClient(String host, int port, int count) {
this.host = host;
this.port = port;
diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java b/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java
index 2cfa7802d1..ca63f47ab0 100644
--- a/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java
+++ b/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java
@@ -28,11 +28,11 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
public class FactorialServer {
private final int port;
-
+
public FactorialServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
diff --git a/src/main/java/org/jboss/netty/example/http/file/HttpStaticFileServer.java b/src/main/java/org/jboss/netty/example/http/file/HttpStaticFileServer.java
index c9099da9d6..945a9accb9 100644
--- a/src/main/java/org/jboss/netty/example/http/file/HttpStaticFileServer.java
+++ b/src/main/java/org/jboss/netty/example/http/file/HttpStaticFileServer.java
@@ -22,13 +22,13 @@ import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
public class HttpStaticFileServer {
-
+
private final int port;
-
+
public HttpStaticFileServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopClient.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopClient.java
index 9099f59802..2872603391 100644
--- a/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopClient.java
+++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopClient.java
@@ -37,7 +37,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
public class HttpSnoopClient {
private final URI uri;
-
+
public HttpSnoopClient(URI uri) {
this.uri = uri;
}
diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopServer.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopServer.java
index 909359aeb2..264f84373a 100644
--- a/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopServer.java
+++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpSnoopServer.java
@@ -26,7 +26,7 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
* in a pretty plaintext form.
*/
public class HttpSnoopServer {
-
+
private final int port;
public HttpSnoopServer(int port) {
diff --git a/src/main/java/org/jboss/netty/example/http/tunnel/HttpTunnelingClientExample.java b/src/main/java/org/jboss/netty/example/http/tunnel/HttpTunnelingClientExample.java
index f3e04ab328..58b1cb2dfd 100644
--- a/src/main/java/org/jboss/netty/example/http/tunnel/HttpTunnelingClientExample.java
+++ b/src/main/java/org/jboss/netty/example/http/tunnel/HttpTunnelingClientExample.java
@@ -44,7 +44,7 @@ import org.jboss.netty.logging.InternalLogLevel;
public class HttpTunnelingClientExample {
private final URI uri;
-
+
public HttpTunnelingClientExample(URI uri) {
this.uri = uri;
}
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClient.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClient.java
index c708f3d634..85a103b4ae 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClient.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClient.java
@@ -31,27 +31,27 @@ import org.jboss.netty.handler.codec.http.CookieEncoder;
import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpHeaders;
import org.jboss.netty.handler.codec.http.HttpMethod;
+import org.jboss.netty.handler.codec.http.HttpRequest;
+import org.jboss.netty.handler.codec.http.HttpVersion;
+import org.jboss.netty.handler.codec.http.QueryStringEncoder;
import org.jboss.netty.handler.codec.http.multipart.DefaultHttpDataFactory;
import org.jboss.netty.handler.codec.http.multipart.DiskAttribute;
import org.jboss.netty.handler.codec.http.multipart.DiskFileUpload;
import org.jboss.netty.handler.codec.http.multipart.HttpDataFactory;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestEncoder;
-import org.jboss.netty.handler.codec.http.multipart.InterfaceHttpData;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestEncoder.ErrorDataEncoderException;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.jboss.netty.handler.codec.http.QueryStringEncoder;
+import org.jboss.netty.handler.codec.http.multipart.InterfaceHttpData;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
public class HttpUploadClient {
-
+
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(HttpUploadClient.class);
-
+
private final String baseUri;
private final String filePath;
-
+
public HttpUploadClient(String baseUri, String filePath) {
this.baseUri = baseUri;
this.filePath = filePath;
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientHandler.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientHandler.java
index 8306e37111..46e00186bb 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientHandler.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientHandler.java
@@ -27,7 +27,7 @@ import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.CharsetUtil;
public class HttpUploadClientHandler extends SimpleChannelUpstreamHandler {
-
+
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(HttpUploadClientHandler.class);
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientPipelineFactory.java
index 6bc743cd58..4cf38810d1 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientPipelineFactory.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadClientPipelineFactory.java
@@ -54,7 +54,7 @@ public class HttpUploadClientPipelineFactory implements ChannelPipelineFactory {
// to be used since huge file transfer
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
-
+
pipeline.addLast("handler", new HttpUploadClientHandler());
return pipeline;
}
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServer.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServer.java
index b6bb88614f..e24528f214 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServer.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServer.java
@@ -22,13 +22,13 @@ import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
public class HttpUploadServer {
-
+
private final int port;
-
+
public HttpUploadServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerHandler.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerHandler.java
index b6df1d125f..fdb97746ca 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerHandler.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerHandler.java
@@ -44,6 +44,7 @@ import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
+import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.jboss.netty.handler.codec.http.multipart.Attribute;
import org.jboss.netty.handler.codec.http.multipart.DefaultHttpDataFactory;
import org.jboss.netty.handler.codec.http.multipart.DiskAttribute;
@@ -51,13 +52,12 @@ import org.jboss.netty.handler.codec.http.multipart.DiskFileUpload;
import org.jboss.netty.handler.codec.http.multipart.FileUpload;
import org.jboss.netty.handler.codec.http.multipart.HttpDataFactory;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
-import org.jboss.netty.handler.codec.http.multipart.InterfaceHttpData;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.EndOfDataDecoderException;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.IncompatibleDataDecoderException;
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.NotEnoughDataDecoderException;
+import org.jboss.netty.handler.codec.http.multipart.InterfaceHttpData;
import org.jboss.netty.handler.codec.http.multipart.InterfaceHttpData.HttpDataType;
-import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.CharsetUtil;
diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerPipelineFactory.java
index e81df7ee03..8991d70485 100644
--- a/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerPipelineFactory.java
+++ b/src/main/java/org/jboss/netty/example/http/upload/HttpUploadServerPipelineFactory.java
@@ -15,7 +15,7 @@
*/
package org.jboss.netty.example.http.upload;
-import static org.jboss.netty.channel.Channels.pipeline;
+import static org.jboss.netty.channel.Channels.*;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/AutobahnServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/AutobahnServer.java
index 229788352e..39501e68fc 100644
--- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/AutobahnServer.java
+++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/AutobahnServer.java
@@ -26,13 +26,13 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
* suite
*/
public class AutobahnServer {
-
+
private final int port;
public AutobahnServer(int port) {
this.port = port;
}
-
+
public void run() {
// Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java
index cc77117120..7152c0abbf 100644
--- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java
+++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java
@@ -15,28 +15,28 @@
*/
/**
- * This package is intended for use with testing against the Python
+ * This package is intended for use with testing against the Python
* AutoBahn test suite.
*
*
- *
+ *
* @param channel
* Channel
* @param req
@@ -170,7 +170,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
throw new WebSocketHandshakeException("Requested subprotocol(s) not supported: " + subprotocols);
} else {
res.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol);
- this.setSelectedSubprotocol(selectedSubprotocol);
+ setSelectedSubprotocol(selectedSubprotocol);
}
}
@@ -183,7 +183,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
}
p.replace(HttpRequestDecoder.class, "wsdecoder",
- new WebSocket13FrameDecoder(true, allowExtensions, this.getMaxFramePayloadLength()));
+ new WebSocket13FrameDecoder(true, allowExtensions, getMaxFramePayloadLength()));
p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket13FrameEncoder(false));
return future;
@@ -191,7 +191,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
/**
* Echo back the closing frame and close the connection
- *
+ *
* @param channel
* Channel
* @param frame
diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java
index 6cc107185f..d3c7beb27b 100644
--- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java
+++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java
@@ -17,11 +17,11 @@ package org.jboss.netty.handler.codec.http.websocketx;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
+import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
/**
* Instances the appropriate handshake class to use for servers
@@ -35,10 +35,10 @@ public class WebSocketServerHandshakerFactory {
private final boolean allowExtensions;
private final long maxFramePayloadLength;
-
+
/**
* Constructor
-
+
* @param subprotocols
* CSV of supported protocols. Null if sub protocols not supported.
* @param allowExtensions
@@ -50,7 +50,7 @@ public class WebSocketServerHandshakerFactory {
/**
* Constructor
- *
+ *
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
@@ -62,17 +62,17 @@ public class WebSocketServerHandshakerFactory {
* Maximum allowable frame payload length. Setting this value to your application's requirement may
* reduce denial of service attacks using long data frames.
*/
- public WebSocketServerHandshakerFactory(String webSocketURL, String subprotocols, boolean allowExtensions,
+ public WebSocketServerHandshakerFactory(String webSocketURL, String subprotocols, boolean allowExtensions,
long maxFramePayloadLength) {
this.webSocketURL = webSocketURL;
this.subprotocols = subprotocols;
this.allowExtensions = allowExtensions;
this.maxFramePayloadLength = maxFramePayloadLength;
}
-
+
/**
* Instances a new handshaker
- *
+ *
* @return A new WebSocketServerHandshaker for the requested web socket version. Null if web socket version is not
* supported.
*/
@@ -97,7 +97,7 @@ public class WebSocketServerHandshakerFactory {
/**
* Return that we need cannot not support the web socket version
- *
+ *
* @param channel
* Channel
*/
diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/package-info.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/package-info.java
index 7e9a45628b..d64c1295f9 100644
--- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/package-info.java
+++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/package-info.java
@@ -30,8 +30,8 @@
* For the detailed instruction on adding add Web Socket support to your HTTP
* server, take a look into the WebSocketServerX example located in the
* {@code org.jboss.netty.example.http.websocket} package.
- *
- *
+ *
+ *
* @apiviz.exclude OneToOne(Encoder|Decoder)$
* @apiviz.exclude \.codec\.replay\.
* @apiviz.exclude \.Default
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteInput.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteInput.java
index 5ea086bb78..6a59684a8b 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteInput.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteInput.java
@@ -22,7 +22,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
/**
* {@link ByteInput} implementation which reads its data from a {@link ChannelBuffer}
- *
+ *
*
*/
class ChannelBufferByteInput implements ByteInput {
@@ -32,7 +32,7 @@ class ChannelBufferByteInput implements ByteInput {
public ChannelBufferByteInput(ChannelBuffer buffer) {
this.buffer = buffer;
}
-
+
public void close() throws IOException {
// nothing to do
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteOutput.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteOutput.java
index de95ad3f33..b0c2661bc9 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteOutput.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/ChannelBufferByteOutput.java
@@ -24,28 +24,28 @@ import org.jboss.netty.buffer.ChannelBuffers;
/**
* {@link ByteOutput} implementation which writes the data to a {@link ChannelBuffer}
- *
+ *
*
*/
class ChannelBufferByteOutput implements ByteOutput {
-
+
private final ChannelBuffer buffer;
-
+
/**
* Create a new instance which use the given {@link ChannelBuffer}
*/
public ChannelBufferByteOutput(ChannelBuffer buffer) {
this.buffer = buffer;
}
-
+
/**
- * Calls {@link #ChannelBufferByteOutput(ChannelBuffer)} with a dynamic {@link ChannelBuffer}
+ * Calls {@link #ChannelBufferByteOutput(ChannelBuffer)} with a dynamic {@link ChannelBuffer}
*/
public ChannelBufferByteOutput(ChannelBufferFactory factory, int estimatedLength) {
this(ChannelBuffers.dynamicBuffer(estimatedLength, factory));
}
-
+
public void close() throws IOException {
// Nothing todo
}
@@ -65,10 +65,10 @@ class ChannelBufferByteOutput implements ByteOutput {
public void write(byte[] bytes, int srcIndex, int length) throws IOException {
buffer.writeBytes(bytes, srcIndex, length);
}
-
+
/**
* Return the {@link ChannelBuffer} which contains the written content
- *
+ *
*/
public ChannelBuffer getBuffer() {
return buffer;
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java
index 76fdae0b24..5d8beef14f 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java
@@ -29,38 +29,38 @@ import org.jboss.netty.handler.codec.replay.VoidEnum;
/**
* {@link ReplayingDecoder} which use an {@link Unmarshaller} to read the Object out of the {@link ChannelBuffer}.
- *
+ *
* If you can you should use {@link MarshallingDecoder}.
- *
- *
+ *
+ *
*
*/
public class CompatibleMarshallingDecoder extends ReplayingDecoder {
protected final UnmarshallerProvider provider;
protected final int maxObjectSize;
-
+
/**
- * Create a new instance of {@link CompatibleMarshallingDecoder}.
- *
+ * Create a new instance of {@link CompatibleMarshallingDecoder}.
+ *
* @param provider the {@link UnmarshallerProvider} which is used to obtain the {@link Unmarshaller} for the {@link Channel}
* @param maxObjectSize the maximal size (in bytes) of the {@link Object} to unmarshal. Once the size is exceeded
- * the {@link Channel} will get closed. Use a a maxObjectSize of {@link Integer#MAX_VALUE} to disable this.
+ * the {@link Channel} will get closed. Use a a maxObjectSize of {@link Integer#MAX_VALUE} to disable this.
* You should only do this if you are sure that the received Objects will never be big and the
* sending side are trusted, as this opens the possibility for a DOS-Attack due an {@link OutOfMemoryError}.
- *
+ *
*/
public CompatibleMarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize) {
this.provider = provider;
this.maxObjectSize = maxObjectSize;
}
-
+
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, VoidEnum state) throws Exception {
Unmarshaller unmarshaller = provider.getUnmarshaller(ctx);
ByteInput input = new ChannelBufferByteInput(buffer);
if (maxObjectSize != Integer.MAX_VALUE) {
input = new LimitingByteInput(input, maxObjectSize);
- }
+ }
try {
unmarshaller.start(input);
Object obj = unmarshaller.readObject();
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java
index 3403eb2a59..430782dbe2 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingEncoder.java
@@ -17,17 +17,17 @@ package org.jboss.netty.handler.codec.marshalling;
import org.jboss.marshalling.Marshaller;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
/**
- * {@link OneToOneEncoder} implementation which uses JBoss Marshalling to marshal
+ * {@link OneToOneEncoder} implementation which uses JBoss Marshalling to marshal
* an Object.
- *
- * See JBoss Marshalling website
+ *
+ * See JBoss Marshalling website
* for more informations
- *
+ *
* Use {@link MarshallingEncoder} if possible.
*
*/
@@ -39,14 +39,14 @@ public class CompatibleMarshallingEncoder extends OneToOneEncoder {
/**
* Create a new instance of the {@link CompatibleMarshallingEncoder}
- *
+ *
* @param provider the {@link MarshallerProvider} to use to get the {@link Marshaller} for a {@link Channel}
*/
public CompatibleMarshallingEncoder(MarshallerProvider provider) {
this.provider = provider;
}
-
-
+
+
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
Marshaller marshaller = provider.getMarshaller(ctx);
@@ -55,7 +55,7 @@ public class CompatibleMarshallingEncoder extends OneToOneEncoder {
marshaller.writeObject(msg);
marshaller.finish();
marshaller.close();
-
+
return output.getBuffer();
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/ContextBoundUnmarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/ContextBoundUnmarshallerProvider.java
index dee1ae2c83..68d97521db 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/ContextBoundUnmarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/ContextBoundUnmarshallerProvider.java
@@ -23,11 +23,11 @@ import org.jboss.netty.channel.ChannelHandler;
import org.jboss.netty.channel.ChannelHandlerContext;
/**
- * {@link UnmarshallerProvider} which store a reference to the {@link Unmarshaller} in the
- * {@link ChannelHandlerContext} via the {@link ChannelHandlerContext#setAttachment(Object)}
+ * {@link UnmarshallerProvider} which store a reference to the {@link Unmarshaller} in the
+ * {@link ChannelHandlerContext} via the {@link ChannelHandlerContext#setAttachment(Object)}
* method. So the same {@link Unmarshaller} will be used during the life-time of a {@link Channel}
* for the {@link ChannelHandler}'s {@link ChannelHandlerContext}.
- *
+ *
*
*/
public class ContextBoundUnmarshallerProvider extends DefaultUnmarshallerProvider {
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultMarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultMarshallerProvider.java
index dd2c953875..a66bf7dc28 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultMarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultMarshallerProvider.java
@@ -23,17 +23,17 @@ import org.jboss.netty.channel.ChannelHandlerContext;
/**
* Default implementation of {@link MarshallerProvider} which just create a new {@link Marshaller}
* on ever {@link #getMarshaller(ChannelHandlerContext)} call.
- *
+ *
*
*/
public class DefaultMarshallerProvider implements MarshallerProvider {
private final MarshallerFactory factory;
private final MarshallingConfiguration config;
-
+
/**
- * Create a new instance
- *
+ * Create a new instance
+ *
* @param factory the {@link MarshallerFactory} to use to create {@link Marshaller}
* @param config the {@link MarshallingConfiguration}
*/
@@ -41,7 +41,7 @@ public class DefaultMarshallerProvider implements MarshallerProvider {
this.factory = factory;
this.config = config;
}
-
+
public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception {
return factory.createMarshaller(config);
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultUnmarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultUnmarshallerProvider.java
index 441831b90b..a3a0afc491 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultUnmarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/DefaultUnmarshallerProvider.java
@@ -29,10 +29,10 @@ public class DefaultUnmarshallerProvider implements UnmarshallerProvider {
private final MarshallerFactory factory;
private final MarshallingConfiguration config;
-
+
/**
- * Create a new instance of {@link DefaultMarshallerProvider}
- *
+ * Create a new instance of {@link DefaultMarshallerProvider}
+ *
* @param factory the {@link MarshallerFactory} to use to create {@link Unmarshaller}
* @param config the {@link MarshallingConfiguration}
*/
@@ -40,7 +40,7 @@ public class DefaultUnmarshallerProvider implements UnmarshallerProvider {
this.factory = factory;
this.config = config;
}
-
+
public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception {
return factory.createUnmarshaller(config);
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/LimitingByteInput.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/LimitingByteInput.java
index 5076943ecf..70b1b66ab4 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/LimitingByteInput.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/LimitingByteInput.java
@@ -22,14 +22,14 @@ import org.jboss.marshalling.ByteInput;
/**
* {@link ByteInput} implementation which wraps another {@link ByteInput} and throws a {@link TooBigObjectException}
* if the read limit was reached.
- *
+ *
*
*/
class LimitingByteInput implements ByteInput {
-
+
// Use a static instance here to remove the overhead of fillStacktrace
private static final TooBigObjectException EXCEPTION = new TooBigObjectException();
-
+
private final ByteInput input;
private final long limit;
private long read;
@@ -41,7 +41,7 @@ class LimitingByteInput implements ByteInput {
this.input = input;
this.limit = limit;
}
-
+
public void close() throws IOException {
// Nothing todo
}
@@ -92,7 +92,7 @@ class LimitingByteInput implements ByteInput {
private int readable(int length) {
return (int) Math.min(length, limit - read);
}
-
+
/**
* Exception that will get thrown if the {@link Object} is to big to unmarshall
*
@@ -100,9 +100,9 @@ class LimitingByteInput implements ByteInput {
static final class TooBigObjectException extends IOException {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
-
+
}
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallerProvider.java
index 83b0dfed66..ae8ff6660e 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallerProvider.java
@@ -19,8 +19,8 @@ import org.jboss.marshalling.Marshaller;
import org.jboss.netty.channel.ChannelHandlerContext;
/**
- * This provider is responsible to get a {@link Marshaller} for the given {@link ChannelHandlerContext}.
- *
+ * This provider is responsible to get a {@link Marshaller} for the given {@link ChannelHandlerContext}.
+ *
*
*/
public interface MarshallerProvider {
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java
index d14faf3343..e826788825 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java
@@ -26,7 +26,7 @@ import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.TooLongFrameException;
/**
* Decoder which MUST be used with {@link MarshallingEncoder}.
- *
+ *
* A {@link LengthFieldBasedFrameDecoder} which use an {@link Unmarshaller} to read the Object out of the {@link ChannelBuffer}.
*
*/
@@ -39,12 +39,12 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder {
* bytes. If the size of the received object is greater than
* {@code 1048576} bytes, a {@link StreamCorruptedException} will be
* raised.
- *
+ *
*/
public MarshallingDecoder(UnmarshallerProvider provider) {
this(provider, 1048576);
}
-
+
/**
* Creates a new decoder with the specified maximum object size.
*
@@ -57,8 +57,8 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder {
super(maxObjectSize, 0, 4, 0, 4);
this.provider = provider;
}
-
-
+
+
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
@@ -70,7 +70,7 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder {
Unmarshaller unmarshaller = provider.getUnmarshaller(ctx);
ByteInput input = new ChannelBufferByteInput(frame);
-
+
try {
unmarshaller.start(input);
Object obj = unmarshaller.readObject();
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingEncoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingEncoder.java
index c82e54d8c3..e8bd2013b9 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingEncoder.java
@@ -18,19 +18,19 @@ package org.jboss.netty.handler.codec.marshalling;
import org.jboss.marshalling.Marshaller;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
/**
- * {@link OneToOneEncoder} implementation which uses JBoss Marshalling to marshal
- * an Object. Be aware that this {@link OneToOneEncoder} is not compatible with
- * an other client that just use JBoss Marshalling as it includes the size of every
+ * {@link OneToOneEncoder} implementation which uses JBoss Marshalling to marshal
+ * an Object. Be aware that this {@link OneToOneEncoder} is not compatible with
+ * an other client that just use JBoss Marshalling as it includes the size of every
* {@link Object} that gets serialized in front of the {@link Object} itself.
- *
+ *
* Use this with {@link MarshallingDecoder}
- *
- * See JBoss Marshalling website
+ *
+ * See JBoss Marshalling website
* for more informations
*
*/
@@ -43,7 +43,7 @@ public class MarshallingEncoder extends OneToOneEncoder {
/**
* Creates a new encoder with the estimated length of 512 bytes.
- *
+ *
* @param provider the {@link MarshallerProvider} to use
*/
public MarshallingEncoder(MarshallerProvider provider) {
@@ -54,7 +54,7 @@ public class MarshallingEncoder extends OneToOneEncoder {
* Creates a new encoder.
*
* @param provider
- * the {@link MarshallerProvider} to use
+ * the {@link MarshallerProvider} to use
* @param estimatedLength
* the estimated byte length of the serialized form of an object.
* If the length of the serialized form exceeds this value, the
@@ -81,11 +81,11 @@ public class MarshallingEncoder extends OneToOneEncoder {
marshaller.writeObject(msg);
marshaller.finish();
marshaller.close();
-
-
+
+
ChannelBuffer encoded = output.getBuffer();
encoded.setInt(0, encoded.writerIndex() - 4);
-
+
return encoded;
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalMarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalMarshallerProvider.java
index 9fb3f865f6..48f2a7a00c 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalMarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalMarshallerProvider.java
@@ -24,9 +24,9 @@ import org.jboss.netty.channel.ChannelHandlerContext;
* {@link UnmarshallerProvider} implementation which use a {@link ThreadLocal} to store references
* to {@link Marshaller} instances. This may give you some performance boost if you need to marshall
* many small {@link Object}'s and your actual Thread count is not to big
- *
- *
- *
+ *
+ *
+ *
*
*/
public class ThreadLocalMarshallerProvider implements MarshallerProvider {
@@ -34,10 +34,10 @@ public class ThreadLocalMarshallerProvider implements MarshallerProvider {
private final MarshallerFactory factory;
private final MarshallingConfiguration config;
-
+
/**
* Create a new instance of the {@link ThreadLocalMarshallerProvider}
- *
+ *
* @param factory the {@link MarshallerFactory} to use to create {@link Marshaller}'s if needed
* @param config the {@link MarshallingConfiguration} to use
*/
diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalUnmarshallerProvider.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalUnmarshallerProvider.java
index c23d56c53d..7d6db75056 100644
--- a/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalUnmarshallerProvider.java
+++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/ThreadLocalUnmarshallerProvider.java
@@ -24,7 +24,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
* {@link UnmarshallerProvider} implementation which use a {@link ThreadLocal} to store references
* to {@link Unmarshaller} instances. This may give you some performance boost if you need to unmarshall
* many small {@link Object}'s.
- *
+ *
*
*/
public class ThreadLocalUnmarshallerProvider implements UnmarshallerProvider {
@@ -32,10 +32,10 @@ public class ThreadLocalUnmarshallerProvider implements UnmarshallerProvider {
private final MarshallerFactory factory;
private final MarshallingConfiguration config;
-
+
/**
* Create a new instance of the {@link ThreadLocalUnmarshallerProvider}
- *
+ *
* @param factory the {@link MarshallerFactory} to use to create {@link Unmarshaller}'s if needed
* @param config the {@link MarshallingConfiguration} to use
*/
@@ -52,5 +52,5 @@ public class ThreadLocalUnmarshallerProvider implements UnmarshallerProvider {
}
return unmarshaller;
}
-
+
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java
index 21c38b3a76..93d4985da6 100644
--- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java
@@ -19,10 +19,10 @@ import static org.jboss.netty.buffer.ChannelBuffers.*;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.LengthFieldPrepender;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java
index b8e12a5686..547f502084 100644
--- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java
+++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java
@@ -20,8 +20,8 @@ import static org.jboss.netty.buffer.ChannelBuffers.*;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBufferOutputStream;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
import com.google.protobuf.CodedOutputStream;
diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java
index ee0b0261e5..4486723a07 100644
--- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java
@@ -289,7 +289,7 @@ public abstract class ReplayingDecoder>
private T state;
private int checkpoint;
private boolean needsCleanup;
-
+
/**
* Creates a new instance with no initial state (i.e: {@code null}).
@@ -389,14 +389,14 @@ public abstract class ReplayingDecoder>
}
/**
- * Calls {@link #decode(ChannelHandlerContext, Channel, ChannelBuffer, Enum)}. This method should be never used by {@link ReplayingDecoder} itself.
+ * Calls {@link #decode(ChannelHandlerContext, Channel, ChannelBuffer, Enum)}. This method should be never used by {@link ReplayingDecoder} itself.
* But to be safe we should handle it anyway
*/
@Override
protected final Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
return decode(ctx, channel, buffer, state);
}
-
+
@Override
protected final Object decodeLast(
ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
@@ -419,16 +419,16 @@ public abstract class ReplayingDecoder>
}
needsCleanup = true;
-
+
if (cumulation == null) {
// the cumulation buffer is not created yet so just pass the input
// to callDecode(...) method
- this.cumulation = input;
+ cumulation = input;
replayable = new ReplayingDecoderBuffer(input);
int oldReaderIndex = input.readerIndex();
int inputSize = input.readableBytes();
-
+
// Wrap in try / finally.
//
// See https://github.com/netty/netty/issues/364
@@ -461,15 +461,15 @@ public abstract class ReplayingDecoder>
}
replayable = new ReplayingDecoderBuffer(cumulation);
} else {
- this.cumulation = null;
+ cumulation = null;
replayable = ReplayingDecoderBuffer.EMPTY_BUFFER;
}
}
-
+
} else {
assert cumulation.readable();
boolean fit = false;
-
+
int readable = input.readableBytes();
int writable = cumulation.writableBytes();
int w = writable - readable;
@@ -485,16 +485,16 @@ public abstract class ReplayingDecoder>
// ok the input fit into the cumulation buffer
fit = true;
}
-
+
ChannelBuffer buf;
if (fit) {
// the input fit in the cumulation buffer so copy it over
- buf = this.cumulation;
+ buf = cumulation;
buf.writeBytes(input);
} else {
- // wrap the cumulation and input
+ // wrap the cumulation and input
buf = ChannelBuffers.wrappedBuffer(cumulation, input);
- this.cumulation = buf;
+ cumulation = buf;
replayable = new ReplayingDecoderBuffer(cumulation);
}
@@ -506,17 +506,17 @@ public abstract class ReplayingDecoder>
} finally {
if (!buf.readable()) {
// nothing readable left so reset the state
- this.cumulation = null;
+ cumulation = null;
replayable = ReplayingDecoderBuffer.EMPTY_BUFFER;
} else {
// create a new buffer and copy the readable buffer into it
- this.cumulation = newCumulationBuffer(ctx, buf.readableBytes());
- this.cumulation.writeBytes(buf);
- replayable = new ReplayingDecoderBuffer(this.cumulation);
+ cumulation = newCumulationBuffer(ctx, buf.readableBytes());
+ cumulation.writeBytes(buf);
+ replayable = new ReplayingDecoderBuffer(cumulation);
}
}
-
+
}
}
@@ -599,5 +599,5 @@ public abstract class ReplayingDecoder>
ctx.sendUpstream(e);
}
}
-
+
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java
index 3454d7fb2f..b3bf089868 100644
--- a/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java
+++ b/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java
@@ -20,9 +20,9 @@ import org.jboss.netty.buffer.DynamicChannelBuffer;
/**
* This class is not used by {@link ReplayingDecoder} anymore but is still here to not break API.
- *
+ *
* This class will get removed in the future.
- *
+ *
* @deprecated
*
*/
@@ -37,7 +37,7 @@ class UnsafeDynamicChannelBuffer extends DynamicChannelBuffer {
this(factory, 256);
}
-
+
@Override
protected void checkReadableBytes(int minReaderRemaining) {
// Do not check here - ReplayingDecoderBuffer will check.
diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java
index 93a3eee915..1666144eee 100644
--- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java
@@ -17,8 +17,8 @@ package org.jboss.netty.handler.codec.rtsp;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.http.HttpMessage;
import org.jboss.netty.handler.codec.http.HttpMessageEncoder;
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java
index 200d280e65..7afb9fc0ee 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java
@@ -40,7 +40,7 @@ public final class ClassResolvers {
public static ClassResolver weakCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new HashMap>>()));
}
-
+
/**
* agressive non-concurrent cache
* good for non-shared cache, when we're not worried about class unloading
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java
index 4cf413538f..c6a761606b 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java
@@ -23,7 +23,7 @@ import java.io.ObjectStreamClass;
import java.io.StreamCorruptedException;
class CompactObjectInputStream extends ObjectInputStream {
-
+
private final ClassResolver classResolver;
CompactObjectInputStream(InputStream in, ClassResolver classResolver) throws IOException {
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java
index eef6f056db..03bcd50444 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java
@@ -45,7 +45,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder {
* bytes. If the size of the received object is greater than
* {@code 1048576} bytes, a {@link StreamCorruptedException} will be
* raised.
- *
+ *
* @deprecated use {@link #ObjectDecoder(ClassResolver)}
*/
@Deprecated
@@ -59,13 +59,13 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder {
* bytes. If the size of the received object is greater than
* {@code 1048576} bytes, a {@link StreamCorruptedException} will be
* raised.
- *
+ *
* @param classResolver the {@link ClassResolver} to use for this decoder
*/
public ObjectDecoder(ClassResolver classResolver) {
this(1048576, classResolver);
}
-
+
/**
* Creates a new decoder with the specified maximum object size.
*
@@ -110,7 +110,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder {
public ObjectDecoder(int maxObjectSize, ClassLoader classLoader) {
this(maxObjectSize, ClassResolvers.weakCachingResolver(classLoader));
}
-
+
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java
index 8405ddbed1..a621f09229 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java
@@ -98,7 +98,7 @@ public class ObjectDecoderInputStream extends InputStream implements
} else {
this.in = new DataInputStream(in);
}
- this.classResolver = ClassResolvers.weakCachingResolver(classLoader);
+ classResolver = ClassResolvers.weakCachingResolver(classLoader);
this.maxObjectSize = maxObjectSize;
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java
index 46f60c2099..41eaad26c6 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java
@@ -23,8 +23,8 @@ import java.io.ObjectOutputStream;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBufferOutputStream;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
/**
diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java
index 7161a3cf8c..369178b3f2 100644
--- a/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java
+++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java
@@ -21,7 +21,7 @@ import java.util.Map;
import java.util.Set;
abstract class ReferenceMap implements Map {
-
+
private final Map> delegate;
protected ReferenceMap(Map> delegate) {
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/DefaultSpdyHeaderBlock.java b/src/main/java/org/jboss/netty/handler/codec/spdy/DefaultSpdyHeaderBlock.java
index 1f613d8dac..a8b7fe919a 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/DefaultSpdyHeaderBlock.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/DefaultSpdyHeaderBlock.java
@@ -40,7 +40,7 @@ public class DefaultSpdyHeaderBlock implements SpdyHeaderBlock {
}
public void setInvalid() {
- this.invalid = true;
+ invalid = true;
}
public void addHeader(final String name, final Object value) {
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameDecoder.java
index 676d69b4bb..6fd4b6df3f 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameDecoder.java
@@ -410,7 +410,7 @@ public class SpdyFrameDecoder extends FrameDecoder {
return new DefaultSpdyPingFrame(ID);
case SPDY_GOAWAY_FRAME:
- int minLength = (version < 3) ? 4 : 8;
+ int minLength = version < 3 ? 4 : 8;
if (buffer.readableBytes() < minLength) {
return null;
}
@@ -448,7 +448,7 @@ public class SpdyFrameDecoder extends FrameDecoder {
int streamID;
switch (type) {
case SPDY_SYN_STREAM_FRAME:
- minLength = (version < 3) ? 12 : 10;
+ minLength = version < 3 ? 12 : 10;
if (buffer.readableBytes() < minLength) {
return null;
}
@@ -477,7 +477,7 @@ public class SpdyFrameDecoder extends FrameDecoder {
return spdySynStreamFrame;
case SPDY_SYN_REPLY_FRAME:
- minLength = (version < 3) ? 8 : 4;
+ minLength = version < 3 ? 8 : 4;
if (buffer.readableBytes() < minLength) {
return null;
}
@@ -575,7 +575,7 @@ public class SpdyFrameDecoder extends FrameDecoder {
return;
}
- int lengthFieldSize = (version < 3) ? 2 : 4;
+ int lengthFieldSize = version < 3 ? 2 : 4;
if (numHeaders == -1) {
// Read number of Name/Value pairs
@@ -690,10 +690,10 @@ public class SpdyFrameDecoder extends FrameDecoder {
private boolean isValidControlFrameHeader() {
switch (type) {
case SPDY_SYN_STREAM_FRAME:
- return (version < 3) ? length >= 12 : length >= 10;
+ return version < 3 ? length >= 12 : length >= 10;
case SPDY_SYN_REPLY_FRAME:
- return (version < 3) ? length >= 8 : length >= 4;
+ return version < 3 ? length >= 8 : length >= 4;
case SPDY_RST_STREAM_FRAME:
return flags == 0 && length == 8;
@@ -708,7 +708,7 @@ public class SpdyFrameDecoder extends FrameDecoder {
return length == 4;
case SPDY_GOAWAY_FRAME:
- return (version < 3) ? length == 4 : length == 8;
+ return version < 3 ? length == 4 : length == 8;
case SPDY_HEADERS_FRAME:
if (version < 3) {
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameEncoder.java
index 1d9c965828..6c16cb51f2 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyFrameEncoder.java
@@ -128,7 +128,7 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
int headerBlockLength = data.readableBytes();
int length;
if (version < 3) {
- length = (headerBlockLength == 0) ? 12 : 10 + headerBlockLength;
+ length = headerBlockLength == 0 ? 12 : 10 + headerBlockLength;
} else {
length = 10 + headerBlockLength;
}
@@ -164,7 +164,7 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
int headerBlockLength = data.readableBytes();
int length;
if (version < 3) {
- length = (headerBlockLength == 0) ? 8 : 6 + headerBlockLength;
+ length = headerBlockLength == 0 ? 8 : 6 + headerBlockLength;
} else {
length = 4 + headerBlockLength;
}
@@ -259,7 +259,7 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
} else if (msg instanceof SpdyGoAwayFrame) {
SpdyGoAwayFrame spdyGoAwayFrame = (SpdyGoAwayFrame) msg;
- int length = (version < 3) ? 4 : 8;
+ int length = version < 3 ? 4 : 8;
ChannelBuffer frame = ChannelBuffers.buffer(
ByteOrder.BIG_ENDIAN, SPDY_HEADER_SIZE + length);
frame.writeShort(version | 0x8000);
@@ -280,7 +280,7 @@ public class SpdyFrameEncoder extends OneToOneEncoder {
int headerBlockLength = data.readableBytes();
int length;
if (version < 3) {
- length = (headerBlockLength == 0) ? 4 : 6 + headerBlockLength;
+ length = headerBlockLength == 0 ? 4 : 6 + headerBlockLength;
} else {
length = 4 + headerBlockLength;
}
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibCompressor.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibCompressor.java
index d85e142fc5..0fbf4d08d4 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibCompressor.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibCompressor.java
@@ -15,12 +15,12 @@
*/
package org.jboss.netty.handler.codec.spdy;
+import static org.jboss.netty.handler.codec.spdy.SpdyCodecUtil.*;
+
import java.util.zip.Deflater;
import org.jboss.netty.buffer.ChannelBuffer;
-import static org.jboss.netty.handler.codec.spdy.SpdyCodecUtil.*;
-
class SpdyHeaderBlockZlibCompressor extends SpdyHeaderBlockCompressor {
private final byte[] out = new byte[8192];
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibDecompressor.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibDecompressor.java
index 1f154eb606..92203f29df 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibDecompressor.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHeaderBlockZlibDecompressor.java
@@ -15,13 +15,13 @@
*/
package org.jboss.netty.handler.codec.spdy;
+import static org.jboss.netty.handler.codec.spdy.SpdyCodecUtil.*;
+
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import org.jboss.netty.buffer.ChannelBuffer;
-import static org.jboss.netty.handler.codec.spdy.SpdyCodecUtil.*;
-
class SpdyHeaderBlockZlibDecompressor extends SpdyHeaderBlockDecompressor {
private final int version;
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySession.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySession.java
index b0a8fbe84b..5ed91e7770 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySession.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySession.java
@@ -128,12 +128,12 @@ final class SpdySession {
public int getSendWindowSize(int streamID) {
StreamState state = activeStreams.get(new Integer(streamID));
- return (state != null) ? state.getSendWindowSize() : -1;
+ return state != null ? state.getSendWindowSize() : -1;
}
public int updateSendWindowSize(int streamID, int deltaWindowSize) {
StreamState state = activeStreams.get(new Integer(streamID));
- return (state != null) ? state.updateSendWindowSize(deltaWindowSize) : -1;
+ return state != null ? state.updateSendWindowSize(deltaWindowSize) : -1;
}
public int updateReceiveWindowSize(int streamID, int deltaWindowSize) {
@@ -141,12 +141,12 @@ final class SpdySession {
if (deltaWindowSize > 0) {
state.setReceiveWindowSizeLowerBound(0);
}
- return (state != null) ? state.updateReceiveWindowSize(deltaWindowSize) : -1;
+ return state != null ? state.updateReceiveWindowSize(deltaWindowSize) : -1;
}
public int getReceiveWindowSizeLowerBound(int streamID) {
StreamState state = activeStreams.get(new Integer(streamID));
- return (state != null) ? state.getReceiveWindowSizeLowerBound() : 0;
+ return state != null ? state.getReceiveWindowSizeLowerBound() : 0;
}
public void updateAllReceiveWindowSizes(int deltaWindowSize) {
@@ -165,12 +165,12 @@ final class SpdySession {
public MessageEvent getPendingWrite(int streamID) {
StreamState state = activeStreams.get(new Integer(streamID));
- return (state != null) ? state.getPendingWrite() : null;
+ return state != null ? state.getPendingWrite() : null;
}
public MessageEvent removePendingWrite(int streamID) {
StreamState state = activeStreams.get(new Integer(streamID));
- return (state != null) ? state.removePendingWrite() : null;
+ return state != null ? state.removePendingWrite() : null;
}
private static final class StreamState {
@@ -179,10 +179,10 @@ final class SpdySession {
private volatile boolean remoteSideClosed;
private volatile boolean localSideClosed;
private boolean receivedReply;
- private AtomicInteger sendWindowSize;
- private AtomicInteger receiveWindowSize;
+ private final AtomicInteger sendWindowSize;
+ private final AtomicInteger receiveWindowSize;
private volatile int receiveWindowSizeLowerBound;
- private ConcurrentLinkedQueue pendingWriteQueue =
+ private final ConcurrentLinkedQueue pendingWriteQueue =
new ConcurrentLinkedQueue();
public StreamState(
diff --git a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySessionHandler.java b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySessionHandler.java
index 1f0bbb8bdb..256252d372 100644
--- a/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySessionHandler.java
+++ b/src/main/java/org/jboss/netty/handler/codec/spdy/SpdySessionHandler.java
@@ -93,7 +93,7 @@ public class SpdySessionHandler extends SimpleChannelUpstreamHandler
"unsupported version: " + version);
}
this.server = server;
- this.flowControl = version >= 3;
+ flowControl = version >= 3;
}
@Override
diff --git a/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java b/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java
index f893d78a3b..7085bb0dca 100644
--- a/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java
@@ -19,10 +19,10 @@ import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.Delimiters;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
diff --git a/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java b/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java
index ccb4b9e35e..1a1890bd6d 100644
--- a/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java
+++ b/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java
@@ -21,10 +21,10 @@ import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.Delimiters;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
diff --git a/src/main/java/org/jboss/netty/handler/execution/ChainedExecutor.java b/src/main/java/org/jboss/netty/handler/execution/ChainedExecutor.java
index 4c1880e817..5429b1d33a 100644
--- a/src/main/java/org/jboss/netty/handler/execution/ChainedExecutor.java
+++ b/src/main/java/org/jboss/netty/handler/execution/ChainedExecutor.java
@@ -30,11 +30,11 @@ public class ChainedExecutor implements Executor, ExternalResourceReleasable {
private final Executor cur;
private final Executor next;
private final ChannelEventRunnableFilter filter;
-
+
/**
* Create a new {@link ChainedExecutor} which will used the given {@link ChannelEventRunnableFilter} to see if the {@link #cur} {@link Executor} should get used.
- * Otherwise it will pass the work to the {@link #next} {@link Executor}
- *
+ * Otherwise it will pass the work to the {@link #next} {@link Executor}
+ *
* @param filter the {@link ChannelEventRunnableFilter} which will be used to check if the {@link ChannelEventRunnable} should be passed to the cur or next {@link Executor}
* @param cur the {@link Executor} to use if the {@link ChannelEventRunnableFilter} match
* @param next the {@link Executor} to use if the {@link ChannelEventRunnableFilter} does not match
@@ -54,9 +54,9 @@ public class ChainedExecutor implements Executor, ExternalResourceReleasable {
this.cur = cur;
this.next = next;
}
-
+
/**
- * Execute the passed {@link ChannelEventRunnable} with the current {@link Executor} if the {@link ChannelEventRunnableFilter} match.
+ * Execute the passed {@link ChannelEventRunnable} with the current {@link Executor} if the {@link ChannelEventRunnableFilter} match.
* Otherwise pass it to the next {@link Executor} in the chain.
*/
public void execute(Runnable command) {
@@ -74,7 +74,7 @@ public class ChainedExecutor implements Executor, ExternalResourceReleasable {
releaseExternal(next);
}
-
+
private static void releaseExternal(Executor executor) {
if (executor instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) executor).releaseExternalResources();
diff --git a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java
index 5f3a2e4fdb..0ae4c74867 100644
--- a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java
+++ b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java
@@ -20,7 +20,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.util.EstimatableObjectWrapper;
public abstract class ChannelEventRunnable implements Runnable, EstimatableObjectWrapper {
-
+
protected final ChannelHandlerContext ctx;
protected final ChannelEvent e;
int estimatedSize;
diff --git a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnableFilter.java b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnableFilter.java
index bdce153e3a..e3dbc3620c 100644
--- a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnableFilter.java
+++ b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnableFilter.java
@@ -18,10 +18,10 @@ package org.jboss.netty.handler.execution;
import java.util.concurrent.Executor;
public interface ChannelEventRunnableFilter {
-
+
/**
* Return true if the {@link ChannelEventRunnable} should get handled by the {@link Executor}
- *
+ *
*/
boolean filter(ChannelEventRunnable event);
}
diff --git a/src/main/java/org/jboss/netty/handler/execution/ChannelUpstreamEventRunnable.java b/src/main/java/org/jboss/netty/handler/execution/ChannelUpstreamEventRunnable.java
index 2ad4772ff3..c2625d543f 100644
--- a/src/main/java/org/jboss/netty/handler/execution/ChannelUpstreamEventRunnable.java
+++ b/src/main/java/org/jboss/netty/handler/execution/ChannelUpstreamEventRunnable.java
@@ -36,7 +36,7 @@ public class ChannelUpstreamEventRunnable extends ChannelEventRunnable {
super(ctx, e);
}
-
+
/**
* Sends the event upstream.
*/
diff --git a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java
index 3427f6169f..8bc22635d9 100644
--- a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java
+++ b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java
@@ -111,7 +111,7 @@ public class ExecutionHandler implements ChannelUpstreamHandler, ChannelDownstre
private final Executor executor;
private final boolean handleDownstream;
private final boolean handleUpstream;
-
+
/**
* Creates a new instance with the specified {@link Executor}.
* Specify an {@link OrderedMemoryAwareThreadPoolExecutor} if unsure.
@@ -120,17 +120,17 @@ public class ExecutionHandler implements ChannelUpstreamHandler, ChannelDownstre
this(executor, false, true);
}
-
+
/**
* Use {@link #ExecutionHandler(Executor, boolean, boolean)}
- *
+ *
* {@link Deprecated}
*/
@Deprecated
public ExecutionHandler(Executor executor, boolean handleDownstream) {
this(executor, handleDownstream, true);
}
-
+
/**
* Creates a new instance with the specified {@link Executor}.
* Specify an {@link OrderedMemoryAwareThreadPoolExecutor} if unsure.
diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedDownstreamThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedDownstreamThreadPoolExecutor.java
index 9b462f67e0..ec9f6543b8 100644
--- a/src/main/java/org/jboss/netty/handler/execution/OrderedDownstreamThreadPoolExecutor.java
+++ b/src/main/java/org/jboss/netty/handler/execution/OrderedDownstreamThreadPoolExecutor.java
@@ -15,29 +15,29 @@
*/
package org.jboss.netty.handler.execution;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelEvent;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ChannelFutureListener;
-import org.jboss.netty.util.ObjectSizeEstimator;
-
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
+import org.jboss.netty.util.ObjectSizeEstimator;
+
/**
* {@link Executor} which should be used for downstream {@link ChannelEvent}'s. This implementation will take care of preserve the order of the events in a {@link Channel}.
* If you don't need to preserve the order just use one of the {@link Executor} implementations provided by the static methods of {@link Executors}.
*
*
- *
+ *
* For more informations about how the order is preserved see {@link OrderedMemoryAwareThreadPoolExecutor}
*
*/
public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwareThreadPoolExecutor {
-
+
/**
* Creates a new instance.
*
@@ -73,7 +73,7 @@ public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwar
keepAliveTime, unit, threadFactory);
}
-
+
/**
* Return null
*/
@@ -129,17 +129,17 @@ public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwar
protected boolean shouldCount(Runnable task) {
return false;
}
-
+
@Override
public void execute(Runnable command) {
-
+
// check if the Runnable was of an unsupported type
if (command instanceof ChannelUpstreamEventRunnable) {
throw new RejectedExecutionException("command must be enclosed with an downstream event.");
}
doExecute(command);
}
-
+
@Override
protected Executor getChildExecutor(ChannelEvent e) {
final Object key = getChildExecutorKey(e);
@@ -150,10 +150,10 @@ public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwar
if (oldExecutor != null) {
executor = oldExecutor;
} else {
-
+
// register a listener so that the ChildExecutor will get removed once the channel was closed
e.getChannel().getCloseFuture().addListener(new ChannelFutureListener() {
-
+
public void operationComplete(ChannelFuture future) throws Exception {
removeChildExecutor(key);
}
@@ -164,5 +164,5 @@ public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwar
return executor;
}
-
+
}
diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java
index 7b186ef459..04f82a4781 100644
--- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java
+++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java
@@ -282,11 +282,11 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
protected final class ChildExecutor implements Executor, Runnable {
private final Queue tasks = QueueFactory.createQueue(Runnable.class);
private final AtomicBoolean isRunning = new AtomicBoolean();
-
+
public void execute(Runnable command) {
// TODO: What todo if the add return false ?
tasks.add(command);
-
+
if (!isRunning.get()) {
doUnorderedExecute(this);
@@ -308,7 +308,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
if (task == null) {
break;
}
-
+
boolean ran = false;
beforeExecute(thread, task);
try {
@@ -326,7 +326,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
// set it back to not running
isRunning.set(false);
}
-
+
if (acquired && !isRunning.get() && tasks.peek() != null) {
doUnorderedExecute(this);
}
diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/CIDR.java b/src/main/java/org/jboss/netty/handler/ipfilter/CIDR.java
index f0e881369f..70979ecbee 100644
--- a/src/main/java/org/jboss/netty/handler/ipfilter/CIDR.java
+++ b/src/main/java/org/jboss/netty/handler/ipfilter/CIDR.java
@@ -141,9 +141,9 @@ public abstract class CIDR implements Comparable {
if (!(arg0 instanceof CIDR)) {
return false;
}
- return this.compareTo((CIDR) arg0) == 0;
+ return compareTo((CIDR) arg0) == 0;
}
-
+
@Override
public int hashCode() {
return baseAddress.hashCode();
diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java
index 2c248fcdb8..ed0b9d4ade 100644
--- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java
+++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java
@@ -95,7 +95,7 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler,
}
}
-
+
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
if (e instanceof ChannelStateEvent) {
ChannelStateEvent evt = (ChannelStateEvent) e;
@@ -150,14 +150,14 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler,
ctx.sendUpstream(e);
}
-
+
public void setIpFilterListener(IpFilterListener listener) {
this.listener = listener;
}
-
+
public void removeIpFilterListener() {
- this.listener = null;
+ listener = null;
}
diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnet.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnet.java
index a35c70d0be..6130b33dee 100644
--- a/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnet.java
+++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnet.java
@@ -15,11 +15,12 @@
*/
package org.jboss.netty.handler.ipfilter;
-import org.jboss.netty.logging.InternalLogger;
-import org.jboss.netty.logging.InternalLoggerFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import org.jboss.netty.logging.InternalLogger;
+import org.jboss.netty.logging.InternalLoggerFactory;
+
/**
* This class allows to check if an IP V4 or V6 Address is contained in a subnet.
*
@@ -54,12 +55,12 @@ import java.net.UnknownHostException;
* where inetAddress2 is 1fff:0:0a88:85a3:0:0:ac1f:8001
*/
public class IpSubnet implements IpSet, Comparable {
-
+
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(IpSubnet.class);
-
+
/** Internal representation */
- private CIDR cidr;
+ private final CIDR cidr;
/** Create IpSubnet for ALL (used for ALLOW or DENY ALL) */
public IpSubnet() {
diff --git a/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java b/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java
index d5d4489389..972a7e8145 100644
--- a/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java
+++ b/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java
@@ -362,37 +362,37 @@ public class BufferedWriteHandler extends SimpleChannelHandler implements LifeCy
Throwable cause = null;
for (;;) {
MessageEvent ev = queue.poll();
-
+
if (ev == null) {
break;
}
-
+
if (cause == null) {
cause = new ClosedChannelException();
}
ev.getFuture().setFailure(cause);
-
+
}
if (cause != null) {
Channels.fireExceptionCaught(ctx.getChannel(), cause);
}
-
+
super.channelClosed(ctx, e);
}
public void beforeAdd(ChannelHandlerContext ctx) throws Exception {
// Nothing to do
-
+
}
public void afterAdd(ChannelHandlerContext ctx) throws Exception {
// Nothing to do
-
+
}
public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
// flush a last time before remove the handler
- flush(consolidateOnFlush);
+ flush(consolidateOnFlush);
}
/**
@@ -402,21 +402,21 @@ public class BufferedWriteHandler extends SimpleChannelHandler implements LifeCy
Throwable cause = null;
for (;;) {
MessageEvent ev = queue.poll();
-
+
if (ev == null) {
break;
}
-
+
if (cause == null) {
cause = new IOException("Unable to flush message");
}
ev.getFuture().setFailure(cause);
-
+
}
if (cause != null) {
Channels.fireExceptionCaughtLater(ctx.getChannel(), cause);
}
}
-
-
+
+
}
diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java
index 05ba7b96a2..298e71b3ce 100644
--- a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java
+++ b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java
@@ -91,15 +91,15 @@ public class SslBufferPool {
/**
* 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() {
@@ -109,11 +109,11 @@ public class SslBufferPool {
return (ByteBuffer) pool[-- index].clear();
}
}
-
+
/**
* Release a previous acquired {@link ByteBuffer}
- *
+ *
* @param buffer
*/
public void releaseBuffer(ByteBuffer buffer) {
@@ -122,9 +122,9 @@ public class SslBufferPool {
/**
* Will get removed. Please use {@link #releaseBuffer(ByteBuffer)}
- *
+ *
* @deprecated
- *
+ *
*/
@Deprecated
synchronized void release(ByteBuffer buffer) {
diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java
index 9a38492aef..b11caad308 100644
--- a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java
+++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java
@@ -143,21 +143,21 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
private void discard(ChannelHandlerContext ctx, boolean fireNow) {
ClosedChannelException cause = null;
-
+
for (;;) {
MessageEvent currentEvent = this.currentEvent;
-
- if (this.currentEvent == null) {
- currentEvent = queue.poll();
+
+ if (this.currentEvent == null) {
+ currentEvent = queue.poll();
} else {
- this.currentEvent = null;
+ this.currentEvent = null;
}
- if (currentEvent == null) {
- break;
+ if (currentEvent == null) {
+ break;
}
-
-
+
+
Object m = currentEvent.getMessage();
if (m instanceof ChunkedInput) {
closeInput((ChunkedInput) m);
@@ -171,7 +171,7 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
currentEvent = null;
}
-
+
if (cause != null) {
if (fireNow) {
@@ -189,7 +189,7 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
// use CAS to see if the have flush already running, if so we don't need to take futher actions
if (acquired = flush.compareAndSet(false, true)) {
try {
-
+
if (!channel.isConnected()) {
discard(ctx, fireNow);
return;
@@ -251,12 +251,12 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
this.currentEvent = null;
writeFuture = currentEvent.getFuture();
- // Register a listener which will close the input once the write is complete. This is needed because the Chunk may have
+ // Register a listener which will close the input once the write is complete. This is needed because the Chunk may have
// some resource bound that can not be closed before its not written
//
// See https://github.com/netty/netty/issues/303
writeFuture.addListener(new ChannelFutureListener() {
-
+
public void operationComplete(ChannelFuture future) throws Exception {
closeInput(chunks);
}
@@ -292,10 +292,10 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
// mark the flush as done
flush.set(false);
}
-
+
}
-
- if (acquired && (!channel.isConnected() || (channel.isWritable() && !queue.isEmpty()))) {
+
+ if (acquired && (!channel.isConnected() || channel.isWritable() && !queue.isEmpty())) {
flush(ctx, fireNow);
}
}
@@ -312,12 +312,12 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
public void beforeAdd(ChannelHandlerContext ctx) throws Exception {
// nothing to do
-
+
}
public void afterAdd(ChannelHandlerContext ctx) throws Exception {
// nothing to do
-
+
}
public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
@@ -329,7 +329,7 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
// This method should not need any synchronization as the ChunkedWriteHandler will not receive any new events
public void afterRemove(ChannelHandlerContext ctx) throws Exception {
- // Fail all MessageEvent's that are left. This is needed because otherwise we would never notify the
+ // Fail all MessageEvent's that are left. This is needed because otherwise we would never notify the
// ChannelFuture and the registered FutureListener. See #304
//
Throwable cause = null;
diff --git a/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java b/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java
index 28dc413f3f..38bd621239 100644
--- a/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java
+++ b/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java
@@ -155,8 +155,8 @@ public class TrafficCounter {
if (trafficShapingHandler1 != null) {
trafficShapingHandler1.doAccounting(counter);
}
- timeout =
- counter.timer.newTimeout(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS);
+ timeout =
+ counter.timer.newTimeout(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS);
}
}
@@ -172,7 +172,7 @@ public class TrafficCounter {
if (checkInterval.get() > 0) {
monitorActive.set(true);
timerTask = new TrafficMonitoringTask(trafficShapingHandler, this);
- timeout =
+ timeout =
timer.newTimeout(timerTask, checkInterval.get(), TimeUnit.MILLISECONDS);
}
}
@@ -245,7 +245,7 @@ public class TrafficCounter {
* @param newcheckInterval
*/
public void configure(long newcheckInterval) {
- long newInterval = (newcheckInterval / 10) * 10;
+ long newInterval = newcheckInterval / 10 * 10;
if (checkInterval.get() != newInterval) {
checkInterval.set(newInterval);
if (newInterval <= 0) {
diff --git a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java
index fcafb9c7d5..8b146e2814 100644
--- a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java
+++ b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java
@@ -454,9 +454,9 @@ public class HashedWheelTimer implements Timer {
//
// See https://github.com/netty/netty/issues/356
if (DetectionUtil.isWindows()) {
- sleepTime = (sleepTime / 10) * 10;
+ sleepTime = sleepTime / 10 * 10;
}
-
+
if (sleepTime <= 0) {
break;
}
@@ -505,7 +505,7 @@ public class HashedWheelTimer implements Timer {
// TODO return false
return;
}
-
+
wheel[stopIndex].remove(this);
}
diff --git a/src/main/java/org/jboss/netty/util/internal/DetectionUtil.java b/src/main/java/org/jboss/netty/util/internal/DetectionUtil.java
index f7d98ec1f0..2ee16b9578 100644
--- a/src/main/java/org/jboss/netty/util/internal/DetectionUtil.java
+++ b/src/main/java/org/jboss/netty/util/internal/DetectionUtil.java
@@ -26,9 +26,9 @@ import java.util.zip.Deflater;
* Utility that detects various properties specific to the current runtime
* environment, such as Java version and the availability of the
* {@code sun.misc.Unsafe} object.
- *
+ *
*
- * You can disable the use of {@code sun.misc.Unsafe} if you specify
+ * You can disable the use of {@code sun.misc.Unsafe} if you specify
* the System property org.jboss.netty.tryUnsafe with
* value of false. Default is true.
*/
@@ -42,15 +42,15 @@ public final class DetectionUtil {
// windows
IS_WINDOWS = os.indexOf("win") >= 0;
}
-
+
/**
* Return true if the JVM is running on Windows
- *
+ *
*/
public static boolean isWindows() {
return IS_WINDOWS;
}
-
+
public static boolean hasUnsafe() {
return HAS_UNSAFE;
}
@@ -64,7 +64,7 @@ public final class DetectionUtil {
if (!useUnsafe) {
return false;
}
-
+
try {
Class> unsafeClazz = Class.forName("sun.misc.Unsafe", true, loader);
return hasUnsafeField(unsafeClazz);
@@ -93,7 +93,7 @@ public final class DetectionUtil {
} catch (ClassNotFoundException e) {
//Ignore
}
-
+
try {
Deflater.class.getDeclaredField("SYNC_FLUSH");
return 7;
@@ -110,7 +110,7 @@ public final class DetectionUtil {
return 5;
}
-
+
private DetectionUtil() {
// only static method supported
}
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 0d6ee6437c..4d3116d6a4 100644
--- a/src/main/java/org/jboss/netty/util/internal/QueueFactory.java
+++ b/src/main/java/org/jboss/netty/util/internal/QueueFactory.java
@@ -26,18 +26,18 @@ import org.jboss.netty.logging.InternalLoggerFactory;
* instance for the running JVM.
*/
public final class QueueFactory {
-
+
private static final boolean useUnsafe = DetectionUtil.hasUnsafe();
private static final InternalLogger LOGGER = InternalLoggerFactory.getInstance(QueueFactory.class);
-
+
private QueueFactory() {
// only use static methods!
}
-
-
+
+
/**
- * Create a new unbound {@link BlockingQueue}
- *
+ * Create a new unbound {@link BlockingQueue}
+ *
* @param itemClass the {@link Class} type which will be used as {@link BlockingQueue} items
* @return queue the {@link BlockingQueue} implementation
*/
@@ -47,7 +47,7 @@ public final class QueueFactory {
if (DetectionUtil.javaVersion() >= 7) {
return new java.util.concurrent.LinkedTransferQueue();
}
-
+
try {
if (useUnsafe) {
return new LinkedTransferQueue();
@@ -61,14 +61,14 @@ public final class QueueFactory {
LOGGER.debug("Unable to instance LinkedTransferQueue, fallback to LegacyLinkedTransferQueue", t);
}
}
-
+
return new LegacyLinkedTransferQueue();
-
+
}
-
+
/**
- * Create a new unbound {@link BlockingQueue}
- *
+ * Create a new unbound {@link BlockingQueue}
+ *
* @param collection the collection which should get copied to the newly created {@link BlockingQueue}
* @param itemClass the {@link Class} type which will be used as {@link BlockingQueue} items
* @return queue the {@link BlockingQueue} implementation
@@ -79,7 +79,7 @@ public final class QueueFactory {
if (DetectionUtil.javaVersion() >= 7) {
return new java.util.concurrent.LinkedTransferQueue();
}
-
+
try {
if (useUnsafe) {
return new LinkedTransferQueue(collection);
@@ -91,10 +91,10 @@ public final class QueueFactory {
// 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);
- }
+ }
}
-
+
return new LegacyLinkedTransferQueue(collection);
-
+
}
}
diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/Adler32.java b/src/main/java/org/jboss/netty/util/internal/jzlib/Adler32.java
index 34628e5eef..91a1a032b1 100644
--- a/src/main/java/org/jboss/netty/util/internal/jzlib/Adler32.java
+++ b/src/main/java/org/jboss/netty/util/internal/jzlib/Adler32.java
@@ -113,7 +113,7 @@ final class Adler32 {
}
return s2 << 16 | s1;
}
-
+
private Adler32() {
// Utility class
}
diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/CRC32.java b/src/main/java/org/jboss/netty/util/internal/jzlib/CRC32.java
index 7e7f3c65f8..6ccd4b6020 100644
--- a/src/main/java/org/jboss/netty/util/internal/jzlib/CRC32.java
+++ b/src/main/java/org/jboss/netty/util/internal/jzlib/CRC32.java
@@ -92,7 +92,7 @@ final class CRC32 {
crc32 ^= 0xffffffff;
return crc32;
}
-
+
private CRC32() {
// Utility class
}
diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java b/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java
index a87972e127..e036211cfc 100644
--- a/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java
+++ b/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java
@@ -105,7 +105,7 @@ public final class JZlib {
static enum WrapperType {
NONE, ZLIB, GZIP, ZLIB_OR_NONE;
}
-
+
private JZlib() {
// Utility class
}
diff --git a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java
index cf46ee5bfc..dfd500efec 100644
--- a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java
+++ b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java
@@ -22,8 +22,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.NoSuchElementException;
import java.util.Map.Entry;
+import java.util.NoSuchElementException;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelHandler;
diff --git a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java
index d6f7812e8a..173b2d19db 100644
--- a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java
+++ b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java
@@ -1704,7 +1704,7 @@ public abstract class AbstractChannelBufferTest {
assertFalse(set.contains(elemB));
assertEquals(0, set.size());
}
-
+
// Test case for https://github.com/netty/netty/issues/325
@Test
public void testDiscardAllReadBytes() {
diff --git a/src/test/java/org/jboss/netty/channel/local/LocalAddressTest.java b/src/test/java/org/jboss/netty/channel/local/LocalAddressTest.java
index 5f0a35529d..c001a0f6d9 100644
--- a/src/test/java/org/jboss/netty/channel/local/LocalAddressTest.java
+++ b/src/test/java/org/jboss/netty/channel/local/LocalAddressTest.java
@@ -15,21 +15,17 @@
*/
package org.jboss.netty.channel.local;
-import org.junit.Assert;
-import org.junit.Test;
-
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.channel.local.DefaultLocalClientChannelFactory;
-import org.jboss.netty.channel.local.DefaultLocalServerChannelFactory;
-import org.jboss.netty.channel.local.LocalAddress;
+import org.junit.Assert;
+import org.junit.Test;
public class LocalAddressTest {
private static String LOCAL_ADDR_ID = "test.id";
@@ -67,7 +63,7 @@ public class LocalAddressTest {
// Start server
sb.bind(addr);
-
+
// Connect to the server
ChannelFuture connectFuture = cb.connect(addr);
connectFuture.awaitUninterruptibly();
@@ -80,7 +76,7 @@ public class LocalAddressTest {
// Wait until the connection is closed, or the connection attempt fails
connectFuture.getChannel().getCloseFuture().awaitUninterruptibly();
-
+
sb.releaseExternalResources();
cb.releaseExternalResources();
diff --git a/src/test/java/org/jboss/netty/channel/local/LocalClientTest.java b/src/test/java/org/jboss/netty/channel/local/LocalClientTest.java
index 31cd210cd3..b2e69c43e0 100644
--- a/src/test/java/org/jboss/netty/channel/local/LocalClientTest.java
+++ b/src/test/java/org/jboss/netty/channel/local/LocalClientTest.java
@@ -15,8 +15,7 @@
*/
package org.jboss.netty.channel.local;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.concurrent.CountDownLatch;
@@ -37,34 +36,34 @@ public class LocalClientTest {
@Test
public void testLocalAddressBind() throws InterruptedException {
ServerBootstrap sb = new ServerBootstrap(new DefaultLocalServerChannelFactory());
-
+
LocalAddress addr = new LocalAddress("Server");
LocalAddress addr2 = new LocalAddress("C1");
sb.bind(addr);
-
-
+
+
ClientBootstrap cb = new ClientBootstrap(new DefaultLocalClientChannelFactory());
final ExceptionHandler handler = new ExceptionHandler();
cb.setPipelineFactory(new ChannelPipelineFactory() {
-
+
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(handler);
}
});
ChannelFuture cf = cb.connect(addr, addr2).awaitUninterruptibly();
-
+
assertTrue(cf.isSuccess());
assertTrue(cf.getChannel().close().awaitUninterruptibly().isSuccess());
-
+
assertNull(handler.await());
sb.releaseExternalResources();
cb.releaseExternalResources();
}
-
+
final class ExceptionHandler extends SimpleChannelUpstreamHandler {
private final CountDownLatch latch = new CountDownLatch(1);
private Throwable t;
-
+
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
super.exceptionCaught(ctx, e);
@@ -76,12 +75,12 @@ public class LocalClientTest {
super.channelClosed(ctx, e);
latch.countDown();
}
-
+
public Throwable await() throws InterruptedException {
latch.await();
return t;
-
+
}
-
+
}
}
diff --git a/src/test/java/org/jboss/netty/channel/socket/AbstractDatagramTest.java b/src/test/java/org/jboss/netty/channel/socket/AbstractDatagramTest.java
index 41c75461bd..1b3480da39 100644
--- a/src/test/java/org/jboss/netty/channel/socket/AbstractDatagramTest.java
+++ b/src/test/java/org/jboss/netty/channel/socket/AbstractDatagramTest.java
@@ -15,16 +15,7 @@
*/
package org.jboss.netty.channel.socket;
-import static org.junit.Assert.assertTrue;
-import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.channel.socket.DatagramChannelFactory;
-import org.jboss.netty.util.internal.ExecutorUtil;
+import static org.junit.Assert.*;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;
@@ -33,6 +24,14 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.util.internal.ExecutorUtil;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -60,7 +59,7 @@ public abstract class AbstractDatagramTest {
public void testSimpleSend() throws Throwable {
ConnectionlessBootstrap sb = new ConnectionlessBootstrap(newServerSocketChannelFactory(executor));
ConnectionlessBootstrap cb = new ConnectionlessBootstrap(newClientSocketChannelFactory(executor));
-
+
final CountDownLatch latch = new CountDownLatch(1);
sb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler() {
@@ -71,7 +70,7 @@ public abstract class AbstractDatagramTest {
latch.countDown();
}
-
+
});
cb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler());
@@ -85,6 +84,6 @@ public abstract class AbstractDatagramTest {
assertTrue(latch.await(10, TimeUnit.SECONDS));
sc.close().awaitUninterruptibly();
cc.close().awaitUninterruptibly();
-
+
}
}
diff --git a/src/test/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfigTest.java b/src/test/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfigTest.java
index 040cba1db1..225e8301e5 100644
--- a/src/test/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfigTest.java
+++ b/src/test/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfigTest.java
@@ -15,8 +15,6 @@
*/
package org.jboss.netty.channel.socket.nio;
-import org.jboss.netty.util.internal.DetectionUtil;
-
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
@@ -27,6 +25,7 @@ import java.util.Enumeration;
import junit.framework.Assert;
+import org.jboss.netty.util.internal.DetectionUtil;
import org.junit.Test;
public class DefaultNioDatagramChannelConfigTest {
@@ -37,7 +36,7 @@ public class DefaultNioDatagramChannelConfigTest {
if (DetectionUtil.javaVersion() < 7) {
return;
}
-
+
StandardProtocolFamily family = null;
NetworkInterface inf = null;
Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
@@ -58,19 +57,19 @@ public class DefaultNioDatagramChannelConfigTest {
// No usable interface found so just skip the test
return;
}
-
+
DefaultNioDatagramChannelConfig config = new DefaultNioDatagramChannelConfig(DatagramChannel.open(family));
config.setNetworkInterface(inf);
Assert.assertEquals(inf, config.getNetworkInterface());
-
+
InetAddress localhost = inf.getInetAddresses().nextElement();
config.setInterface(localhost);
Assert.assertEquals(localhost, config.getInterface());
-
+
config.setTimeToLive(100);
Assert.assertEquals(100, config.getTimeToLive());
-
+
config.setLoopbackModeDisabled(false);
Assert.assertEquals(false, config.isLoopbackModeDisabled());
}
diff --git a/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java
index 8e4944b23d..c04697d66a 100644
--- a/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java
+++ b/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java
@@ -15,9 +15,7 @@
*/
package org.jboss.netty.handler.codec.http;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
import java.text.DateFormat;
import java.util.Date;
@@ -126,7 +124,7 @@ public class CookieEncoderTest {
String encodedCookie = encoder.encode();
assertEquals(c1 + c2 + c3, encodedCookie);
}
-
+
@Test
public void testEncodingWithNoCookies() {
CookieEncoder encoderForServer = new CookieEncoder(true);
@@ -134,8 +132,8 @@ public class CookieEncoderTest {
CookieEncoder encoderForClient = new CookieEncoder(false);
String encodedCookie2 = encoderForClient.encode();
assertNotNull(encodedCookie1);
- assertNotNull(encodedCookie2);
-
+ assertNotNull(encodedCookie2);
+
}
-
+
}
diff --git a/src/test/java/org/jboss/netty/handler/codec/http/HttpClientCodecTest.java b/src/test/java/org/jboss/netty/handler/codec/http/HttpClientCodecTest.java
index 4bda7566bb..38db977b7c 100644
--- a/src/test/java/org/jboss/netty/handler/codec/http/HttpClientCodecTest.java
+++ b/src/test/java/org/jboss/netty/handler/codec/http/HttpClientCodecTest.java
@@ -15,8 +15,7 @@
*/
package org.jboss.netty.handler.codec.http;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@@ -31,7 +30,7 @@ public class HttpClientCodecTest {
private static final String RESPONSE = "HTTP/1.0 200 OK\r\n" + "Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n" + "Content-Type: text/html\r\n" + "Content-Length: 28\r\n" + "\r\n"
+ "\r\n";
- private static final String INCOMPLETE_CHUNKED_RESPONSE = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/plain\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n"
+ private static final String INCOMPLETE_CHUNKED_RESPONSE = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/plain\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n"
+"5\r\n" + "first\r\n" + "6\r\n" + "second\r\n" + "0\r\n";
private static final String CHUNKED_RESPONSE = INCOMPLETE_CHUNKED_RESPONSE + "\r\n";
@@ -40,34 +39,34 @@ public class HttpClientCodecTest {
HttpClientCodec codec = new HttpClientCodec(4096, 8192, 8192, true);
DecoderEmbedder decoder = new DecoderEmbedder(codec);
EncoderEmbedder encoder = new EncoderEmbedder(codec);
-
+
encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/"));
decoder.offer(ChannelBuffers.copiedBuffer(RESPONSE, CharsetUtil.ISO_8859_1));
encoder.finish();
decoder.finish();
-
+
}
-
+
@Test
public void testFailsNotOnRequestResponseChunked() {
HttpClientCodec codec = new HttpClientCodec(4096, 8192, 8192, true);
DecoderEmbedder decoder = new DecoderEmbedder(codec);
EncoderEmbedder encoder = new EncoderEmbedder(codec);
-
+
encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/"));
decoder.offer(ChannelBuffers.copiedBuffer(CHUNKED_RESPONSE, CharsetUtil.ISO_8859_1));
encoder.finish();
decoder.finish();
-
+
}
-
+
@Test
public void testFailsOnMissingResponse() {
HttpClientCodec codec = new HttpClientCodec(4096, 8192, 8192, true);
EncoderEmbedder encoder = new EncoderEmbedder(codec);
-
+
encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/"));
try {
@@ -76,16 +75,16 @@ public class HttpClientCodecTest {
} catch (CodecEmbedderException e) {
assertTrue(e.getCause() instanceof PrematureChannelClosureException);
}
-
+
}
-
+
@Test
public void testFailsOnIncompleteChunkedResponse() {
HttpClientCodec codec = new HttpClientCodec(4096, 8192, 8192, true);
DecoderEmbedder decoder = new DecoderEmbedder(codec);
EncoderEmbedder encoder = new EncoderEmbedder(codec);
-
+
encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/"));
decoder.offer(ChannelBuffers.copiedBuffer(INCOMPLETE_CHUNKED_RESPONSE, CharsetUtil.ISO_8859_1));
@@ -96,6 +95,6 @@ public class HttpClientCodecTest {
} catch (CodecEmbedderException e) {
assertTrue(e.getCause() instanceof PrematureChannelClosureException);
}
-
+
}
}
diff --git a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java
index 6dc327d5c2..2c8e99ddf0 100644
--- a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java
+++ b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java
@@ -110,7 +110,7 @@ public class QueryStringDecoderTest {
}
Assert.assertEquals(1024, new QueryStringDecoder(buf.toString()).getParameters().size());
}
-
+
@Test
public void testHasPath() throws Exception {
QueryStringDecoder decoder = new QueryStringDecoder("1=2", false);
@@ -167,7 +167,7 @@ public class QueryStringDecoderTest {
Assert.assertEquals(ed.getPath(), ad.getPath());
Assert.assertEquals(ed.getParameters(), ad.getParameters());
}
-
+
// See #189
@Test
public void testURI() {
@@ -177,26 +177,26 @@ public class QueryStringDecoderTest {
Map> params = decoder.getParameters();
Assert.assertEquals(3, params.size());
Iterator>> entries = params.entrySet().iterator();
-
+
Entry> entry = entries.next();
Assert.assertEquals("param1", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value1", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param2", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value2", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param3", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value3", entry.getValue().get(0));
-
+
Assert.assertFalse(entries.hasNext());
}
-
+
// See #189
@Test
public void testURISlashPath() {
@@ -206,26 +206,26 @@ public class QueryStringDecoderTest {
Map> params = decoder.getParameters();
Assert.assertEquals(3, params.size());
Iterator>> entries = params.entrySet().iterator();
-
+
Entry> entry = entries.next();
Assert.assertEquals("param1", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value1", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param2", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value2", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param3", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value3", entry.getValue().get(0));
-
+
Assert.assertFalse(entries.hasNext());
}
-
+
// See #189
@Test
public void testURINoPath() {
@@ -235,23 +235,23 @@ public class QueryStringDecoderTest {
Map> params = decoder.getParameters();
Assert.assertEquals(3, params.size());
Iterator>> entries = params.entrySet().iterator();
-
+
Entry> entry = entries.next();
Assert.assertEquals("param1", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value1", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param2", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value2", entry.getValue().get(0));
-
+
entry = entries.next();
Assert.assertEquals("param3", entry.getKey());
Assert.assertEquals(1, entry.getValue().size());
Assert.assertEquals("value3", entry.getValue().get(0));
-
+
Assert.assertFalse(entries.hasNext());
}
}
diff --git a/src/test/java/org/jboss/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java
index 0f4d758315..5567c093c2 100644
--- a/src/test/java/org/jboss/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java
+++ b/src/test/java/org/jboss/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java
@@ -15,9 +15,7 @@
*/
package org.jboss.netty.handler.codec.marshalling;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -43,68 +41,68 @@ public abstract class AbstractCompatibleMarshallingDecoderTest {
public void testSimpleUnmarshalling() throws IOException {
MarshallerFactory marshallerFactory = createMarshallerFactory();
MarshallingConfiguration configuration = createMarshallingConfig();
-
+
DecoderEmbedder