* Added @Sharable annotation which replaces @ChannelPipelineCoverage
* Removed annotations from the examples because it's not essential part of learning the framework - User guide will explain about it later
This commit is contained in:
parent
2f7c758fe6
commit
4a3495b1c8
@ -15,6 +15,13 @@
|
||||
*/
|
||||
package org.jboss.netty.channel;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.jboss.netty.bootstrap.Bootstrap;
|
||||
|
||||
/**
|
||||
@ -92,6 +99,7 @@ import org.jboss.netty.bootstrap.Bootstrap;
|
||||
* In such a case, you can use an <em>attachment</em> which is provided by
|
||||
* {@link ChannelHandlerContext}:
|
||||
* <pre>
|
||||
* {@literal @Sharable}
|
||||
* public class DataServerHandler extends SimpleChannelHandler {
|
||||
*
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
@ -137,6 +145,7 @@ import org.jboss.netty.bootstrap.Bootstrap;
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* {@literal @Sharable}
|
||||
* public class DataServerHandler extends SimpleChannelHandler {
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
* Channel ch = e.getChannel();
|
||||
@ -163,6 +172,23 @@ import org.jboss.netty.bootstrap.Bootstrap;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h4>The {@literal @Sharable} annotation</h4>
|
||||
* <p>
|
||||
* In the examples above which used an attachment or a {@link ChannelLocal},
|
||||
* you might have noticed the {@literal @Sharable} annotation.
|
||||
* <p>
|
||||
* If a {@link ChannelHandler} is annotated with the {@literal @Sharable}
|
||||
* annotation, it means you can create an instance of the handler just once and
|
||||
* add it to one or more {@link ChannelPipeline}s multiple times without
|
||||
* a race condition.
|
||||
* <p>
|
||||
* If this annotation is not specified, it is safe to create a new handler
|
||||
* instance every time you add it to a pipeline because it has unshared state
|
||||
* such as member variables.
|
||||
* <p>
|
||||
* This annotation is provided for documentation purpose, just like
|
||||
* <a href="http://www.javaconcurrencyinpractice.com/annotations/doc/">the JCIP annotations</a>.
|
||||
*
|
||||
* <h3>Additional resources worth reading</h3>
|
||||
* <p>
|
||||
* Please refer to the {@link ChannelEvent} and {@link ChannelPipeline} to find
|
||||
@ -178,5 +204,28 @@ import org.jboss.netty.bootstrap.Bootstrap;
|
||||
* @apiviz.exclude ^org\.jboss\.netty\.handler\..*$
|
||||
*/
|
||||
public interface ChannelHandler {
|
||||
// This is a tag interface.
|
||||
|
||||
/**
|
||||
* Indicates that the same instance of the annotated {@link ChannelHandler}
|
||||
* can be added to one or more {@link ChannelPipeline}s multiple times
|
||||
* without a race condition.
|
||||
* <p>
|
||||
* If this annotation is not specified, it is safe to create a new handler
|
||||
* instance every time you add it to a pipeline because it has unshared
|
||||
* state such as member variables.
|
||||
* <p>
|
||||
* This annotation is provided for documentation purpose, just like
|
||||
* <a href="http://www.javaconcurrencyinpractice.com/annotations/doc/">the JCIP annotations</a>.
|
||||
*
|
||||
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Sharable {
|
||||
// no value
|
||||
}
|
||||
}
|
||||
|
@ -21,186 +21,12 @@ import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
|
||||
/**
|
||||
* Specifies if the same instance of the annotated {@link ChannelHandler} type
|
||||
* can be added to more than one {@link ChannelPipeline}.
|
||||
* <p>
|
||||
* All handler types are expected to specify this annotation. Otherwise you
|
||||
* will be warned in runtime. Only two values are allowed for this annotation:
|
||||
* {@code "all"} and {@code "one"}.
|
||||
* <p>
|
||||
* Please note that this annotation does not prevent a handler annotated with
|
||||
* the value {@code "one"} from being added to more than one pipeline. This
|
||||
* annotation is used for documentation purpose only.
|
||||
*
|
||||
* <h3>{@code ChannelPipelineCoverage("all")}</h3>
|
||||
*
|
||||
* {@code "all"} means you can add the same instance of the annotated handler
|
||||
* type to more than one {@link ChannelPipeline}. It means the member
|
||||
* variables of the handler instance is shared among multiple channels and it
|
||||
* is designed to be OK to do so (or there's nothing to share.) The following
|
||||
* code shows an example of a handler type annotated with {@code "all"} value:
|
||||
*
|
||||
* <pre>
|
||||
* public class StatelessHandler extends SimpleChannelHandler {
|
||||
*
|
||||
* // No state properties - you are safe to add the same instance to
|
||||
* // multiple pipelines.
|
||||
*
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
* // Prepend a length field to the message.
|
||||
* ChannelBuffer body = (ChannelBuffer) e.getMessage();
|
||||
* ChannelBuffer header = ChannelBuffers.buffer(4);
|
||||
* header.writeInt(body.readableBytes());
|
||||
*
|
||||
* // Create a message prepended with the header and send a new event.
|
||||
* ChannelBuffer message = ChannelBuffers.wrappedBuffer(header, body);
|
||||
* Channels.fireMessageReceived(ctx, message, e.getRemoteAddress());
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Please note that the handler annotated with {@code "all"} can even be added
|
||||
* to the same pipeline more than once:
|
||||
*
|
||||
* <pre>
|
||||
* ChannelPipeline p = ...;
|
||||
* StatelessHandler h = ...;
|
||||
* p.addLast("handler1", h);
|
||||
* p.addLast("handler2", h);
|
||||
* </pre>
|
||||
*
|
||||
* <h3>{@code ChannelPipelineCoverage("one")}</h3>
|
||||
*
|
||||
* {@code "one"} means you must create a new instance of the annotated handler
|
||||
* type for each new channel. It means the member variables of the handler
|
||||
* instance can not be shared at all, and violating this contract will lead
|
||||
* the handler to a race condition. A new handler instance is usually created
|
||||
* by {@link ChannelPipelineFactory}. The following code shows an example of a
|
||||
* handler type annotated with {@code "one"} value:
|
||||
*
|
||||
* <pre>
|
||||
* public class StatefulHandler extends SimpleChannelHandler {
|
||||
*
|
||||
* // Stateful property - adding the same instance to multiple pipelines
|
||||
* // can lead to a race condition.
|
||||
* private int messageId;
|
||||
*
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
* // Prepend a message ID and length field to the message.
|
||||
* ChannelBuffer body = (ChannelBuffer) e.getMessage();
|
||||
* ChannelBuffer header = ChannelBuffers.buffer(8);
|
||||
* header.writeInt(messageId);
|
||||
* header.writeInt(body.readableBytes());
|
||||
*
|
||||
* // Update the stateful property.
|
||||
* messageId ++;
|
||||
*
|
||||
* // Create a message prepended with the header and send a new event.
|
||||
* ChannelBuffer message = ChannelBuffers.wrappedBuffer(header, body);
|
||||
* Channels.fireMessageReceived(ctx, message, e.getRemoteAddress());
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* // Create a new handler instance per channel.
|
||||
* public class MyPipelineFactory implements ChannelPipelineFactory {
|
||||
*
|
||||
* public ChannelPipeline getPipeline() {
|
||||
* ChannelPipeline p = Channels.pipeline();
|
||||
* p.addLast("handler", new StatefulHandler());
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h3>Writing a stateful handler with the {@code "all"} coverage</h3>
|
||||
*
|
||||
* Although it's recommended to write a stateful handler with the {@code "one"}
|
||||
* coverage, you might sometimes want to write it with the {@code "all"}
|
||||
* coverage for some reason. In such a case, you need to use either
|
||||
* {@link ChannelHandlerContext#setAttachment(Object) ChannelHandlerContext.attachment}
|
||||
* property or a {@link ConcurrentMap} whose key is {@link ChannelHandlerContext}.
|
||||
* <p>
|
||||
* The following is an example that uses the context attachment:
|
||||
* <pre>
|
||||
* public class StatefulHandler extends SimpleChannelHandler {
|
||||
*
|
||||
* public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {
|
||||
* // Initialize the message ID counter.
|
||||
* // Please note that the attachment (the counter in this case) will be
|
||||
* // dereferenced and marked for garbage collection automatically on
|
||||
* // disconnection.
|
||||
* <strong>ctx.setAttachment(Integer.valueOf(0));</strong>
|
||||
* }
|
||||
*
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
* // Fetch the current message ID.
|
||||
* <strong>int messageId = ((Integer) ctx.getAttachment()).intValue();</strong>
|
||||
*
|
||||
* // Prepend a message ID and length field to the message.
|
||||
* ChannelBuffer body = (ChannelBuffer) e.getMessage();
|
||||
* ChannelBuffer header = ChannelBuffers.buffer(8);
|
||||
* header.writeInt(messageId);
|
||||
* header.writeInt(body.readableBytes());
|
||||
*
|
||||
* // Update the stateful property.
|
||||
* <strong>ctx.setAttachment(Integer.valueOf(messageId + 1));</strong>
|
||||
*
|
||||
* // Create a message prepended with the header and send a new event.
|
||||
* ChannelBuffer message = ChannelBuffers.wrappedBuffer(header, body);
|
||||
* Channels.fireMessageReceived(ctx, message, e.getRemoteAddress());
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* and here's another example that uses a map:
|
||||
* <pre>
|
||||
* public class StatefulHandler extends SimpleChannelHandler {
|
||||
*
|
||||
* <strong>private final ConcurrentMap<ChannelHandlerContext, Integer> messageIds =
|
||||
* new ConcurrentHashMap<ChannelHandlerContext, Integer>();</strong>
|
||||
*
|
||||
* public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {
|
||||
* // Initialize the message ID counter.
|
||||
* <strong>messageIds.put(ctx, Integer.valueOf(0));</strong>
|
||||
* }
|
||||
*
|
||||
* public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) {
|
||||
* // Remove the message ID counter from the map.
|
||||
* // Please note that the context attachment does not need this step.
|
||||
* <strong>messageIds.remove(ctx);</strong>
|
||||
* }
|
||||
*
|
||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||
* // Fetch the current message ID.
|
||||
* <strong>int messageId = messageIds.get(ctx).intValue();</strong>
|
||||
*
|
||||
* // Prepend a message ID and length field to the message.
|
||||
* ChannelBuffer body = (ChannelBuffer) e.getMessage();
|
||||
* ChannelBuffer header = ChannelBuffers.buffer(8);
|
||||
* header.writeInt(messageId);
|
||||
* header.writeInt(body.readableBytes());
|
||||
*
|
||||
* // Update the stateful property.
|
||||
* <strong>messageIds.put(ctx, Integer.valueOf(messageId + 1));</strong>
|
||||
*
|
||||
* // Create a message prepended with the header and send a new event.
|
||||
* ChannelBuffer message = ChannelBuffers.wrappedBuffer(header, body);
|
||||
* Channels.fireMessageReceived(ctx, message, e.getRemoteAddress());
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Please note that the examples above in this section assume that the handlers
|
||||
* are added before the {@code channelOpen} event and removed after the
|
||||
* {@code channelClosed} event. The initialization and removal of the message
|
||||
* ID property could have been more complicated otherwise.
|
||||
*
|
||||
* @deprecated Use the {@link Sharable} annotation instead.
|
||||
|
||||
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
*
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelState;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
@ -40,7 +39,6 @@ import org.jboss.netty.channel.WriteCompletionEvent;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class DiscardClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -22,7 +22,6 @@ import java.util.logging.Logger;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -36,7 +35,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class DiscardServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -22,7 +22,6 @@ import java.util.logging.Logger;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -38,7 +37,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class EchoClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -21,7 +21,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -34,7 +33,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class EchoServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -26,7 +26,6 @@ import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -44,7 +43,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one") // <-- HERE
|
||||
public class FactorialClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -22,7 +22,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -40,7 +39,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one") // <-- HERE
|
||||
public class FactorialServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -21,7 +21,6 @@ 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.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
/**
|
||||
@ -34,7 +33,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
* @version $Rev$, $Date$
|
||||
*
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class NumberEncoder extends OneToOneEncoder {
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,6 @@ import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -48,7 +47,6 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpStaticFileServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -52,7 +51,6 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpRequestHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private volatile HttpRequest request;
|
||||
|
@ -17,7 +17,6 @@ package org.jboss.netty.example.http.snoop;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
import org.jboss.netty.handler.codec.http.HttpChunk;
|
||||
@ -31,7 +30,6 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpResponseHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private volatile boolean readingChunks;
|
||||
|
@ -28,7 +28,6 @@ import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -51,7 +50,6 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class WebSocketServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final String WEBSOCKET_PATH = "/websocket";
|
||||
|
@ -21,7 +21,6 @@ import org.jboss.netty.channel.ChannelDownstreamHandler;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
@ -53,7 +52,6 @@ public class LocalServerPipelineFactory implements ChannelPipelineFactory {
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
@ChannelPipelineCoverage("all")
|
||||
static class EchoCloseServerHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler {
|
||||
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
|
||||
throws Exception {
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -44,7 +43,6 @@ import org.jboss.netty.example.localtime.LocalTimeProtocol.Locations;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class LocalTimeClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -24,7 +24,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -42,7 +41,6 @@ import org.jboss.netty.example.localtime.LocalTimeProtocol.Locations;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class LocalTimeServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -23,7 +23,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelState;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
@ -40,7 +39,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class ObjectEchoClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -21,7 +21,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelState;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
@ -37,7 +36,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class ObjectEchoServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -36,7 +35,6 @@ import org.jboss.netty.channel.socket.ClientSocketChannelFactory;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HexDumpProxyInboundHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private final ClientSocketChannelFactory cf;
|
||||
@ -102,7 +100,6 @@ public class HexDumpProxyInboundHandler extends SimpleChannelUpstreamHandler {
|
||||
closeOnFlush(e.getChannel());
|
||||
}
|
||||
|
||||
@ChannelPipelineCoverage("one")
|
||||
private static class OutboundHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private final Channel inboundChannel;
|
||||
|
@ -16,7 +16,6 @@
|
||||
package org.jboss.netty.example.qotm;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -26,7 +25,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class QuoteOfTheMomentClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,6 @@ package org.jboss.netty.example.qotm;
|
||||
import java.util.Random;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -28,7 +27,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class QuoteOfTheMomentServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
@ -20,7 +20,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -35,7 +34,6 @@ import org.jboss.netty.handler.ssl.SslHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class SecureChatClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -41,7 +40,6 @@ import org.jboss.netty.handler.ssl.SslHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class SecureChatServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -20,7 +20,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -34,7 +33,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class TelnetClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -38,7 +37,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
public class TelnetServerHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
|
@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.bootstrap.ClientBootstrap;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -38,7 +37,6 @@ import org.jboss.netty.util.TimerTask;
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class UptimeClientHandler extends SimpleChannelUpstreamHandler {
|
||||
|
||||
final ClientBootstrap bootstrap;
|
||||
|
@ -20,7 +20,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
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;
|
||||
@ -50,7 +50,7 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
*
|
||||
* @apiviz.uses org.jboss.netty.handler.codec.base64.Base64
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class Base64Decoder extends OneToOneDecoder {
|
||||
|
||||
private final Base64Dialect dialect;
|
||||
|
@ -19,7 +19,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
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;
|
||||
@ -44,7 +44,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
*
|
||||
* @apiviz.uses org.jboss.netty.handler.codec.base64.Base64
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class Base64Encoder extends OneToOneEncoder {
|
||||
|
||||
private final boolean breakLines;
|
||||
|
@ -19,7 +19,6 @@ 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.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
|
||||
import org.jboss.netty.util.internal.jzlib.JZlib;
|
||||
import org.jboss.netty.util.internal.jzlib.ZStream;
|
||||
@ -32,7 +31,6 @@ import org.jboss.netty.util.internal.jzlib.ZStream;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class ZlibDecoder extends OneToOneDecoder {
|
||||
|
||||
private final ZStream z = new ZStream();
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.LifeCycleAwareChannelHandler;
|
||||
@ -40,7 +39,6 @@ import org.jboss.netty.util.internal.jzlib.ZStream;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class ZlibEncoder extends OneToOneEncoder implements LifeCycleAwareChannelHandler {
|
||||
|
||||
private static final byte[] EMPTY_ARRAY = new byte[0];
|
||||
|
@ -28,7 +28,6 @@ import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelPipelineException;
|
||||
import org.jboss.netty.channel.ChannelSink;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
@ -181,7 +180,6 @@ abstract class AbstractCodecEmbedder<E> implements CodecEmbedder<E> {
|
||||
return productQueue.size();
|
||||
}
|
||||
|
||||
@ChannelPipelineCoverage("all")
|
||||
private final class EmbeddedChannelSink implements ChannelSink, ChannelUpstreamHandler {
|
||||
EmbeddedChannelSink() {
|
||||
super();
|
||||
|
@ -23,7 +23,6 @@ import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
@ -176,7 +175,6 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public abstract class FrameDecoder extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private final boolean unfold;
|
||||
|
@ -23,7 +23,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.buffer.ChannelBufferFactory;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
/**
|
||||
@ -58,7 +58,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class LengthFieldPrepender extends OneToOneEncoder {
|
||||
|
||||
private final int lengthFieldLength;
|
||||
|
@ -22,7 +22,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -51,7 +50,6 @@ import org.jboss.netty.handler.codec.frame.TooLongFrameException;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has org.jboss.netty.handler.codec.http.HttpChunk oneway - - filters out
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpChunkAggregator extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private final int maxContentLength;
|
||||
|
@ -16,7 +16,6 @@
|
||||
package org.jboss.netty.handler.codec.http;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibEncoder;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibWrapper;
|
||||
import org.jboss.netty.handler.codec.embedder.EncoderEmbedder;
|
||||
@ -32,7 +31,6 @@ import org.jboss.netty.handler.codec.embedder.EncoderEmbedder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpContentCompressor extends HttpContentEncoder {
|
||||
|
||||
private final int compressionLevel;
|
||||
|
@ -18,7 +18,6 @@ package org.jboss.netty.handler.codec.http;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
@ -47,7 +46,6 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private volatile DecoderEmbedder<ChannelBuffer> decoder;
|
||||
|
@ -16,7 +16,6 @@
|
||||
package org.jboss.netty.handler.codec.http;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibDecoder;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibWrapper;
|
||||
import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
|
||||
@ -30,7 +29,6 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class HttpContentDecompressor extends HttpContentDecoder {
|
||||
@Override
|
||||
protected DecoderEmbedder<ChannelBuffer> newContentDecoder(String contentEncoding) throws Exception {
|
||||
|
@ -25,7 +25,6 @@ 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.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
import org.jboss.netty.util.CharsetUtil;
|
||||
|
||||
@ -49,7 +48,6 @@ import org.jboss.netty.util.CharsetUtil;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public abstract class HttpMessageEncoder extends OneToOneEncoder {
|
||||
|
||||
private static final ChannelBuffer LAST_CHUNK =
|
||||
|
@ -18,7 +18,6 @@ package org.jboss.netty.handler.codec.http.websocket;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.frame.TooLongFrameException;
|
||||
import org.jboss.netty.handler.codec.replay.ReplayingDecoder;
|
||||
import org.jboss.netty.handler.codec.replay.VoidEnum;
|
||||
@ -35,7 +34,6 @@ import org.jboss.netty.handler.codec.replay.VoidEnum;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class WebSocketFrameDecoder extends ReplayingDecoder<VoidEnum> {
|
||||
|
||||
public static final int DEFAULT_MAX_FRAME_SIZE = 16384;
|
||||
|
@ -18,7 +18,7 @@ package org.jboss.netty.handler.codec.http.websocket;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
/**
|
||||
@ -33,7 +33,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class WebSocketFrameEncoder extends OneToOneEncoder {
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ import org.jboss.netty.buffer.ChannelBufferInputStream;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.handler.codec.frame.FrameDecoder;
|
||||
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
|
||||
import org.jboss.netty.handler.codec.frame.LengthFieldPrepender;
|
||||
@ -67,7 +67,7 @@ import com.google.protobuf.Message;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class ProtobufDecoder extends OneToOneDecoder {
|
||||
|
||||
private final Message prototype;
|
||||
|
@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
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;
|
||||
@ -63,7 +63,7 @@ import com.google.protobuf.Message;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class ProtobufEncoder extends OneToOneEncoder {
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ 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.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
import com.google.protobuf.CodedOutputStream;
|
||||
@ -38,7 +38,7 @@ import com.google.protobuf.CodedOutputStream;
|
||||
* @author Tomasz Blachowicz (tblachowicz@gmail.com)
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class ProtobufVarint32LengthFieldPrepender extends OneToOneEncoder {
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,6 @@ import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
@ -283,7 +282,6 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has org.jboss.netty.handler.codec.replay.UnreplayableOperationException oneway - - throws
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public abstract class ReplayingDecoder<T extends Enum<T>>
|
||||
extends SimpleChannelUpstreamHandler {
|
||||
|
||||
|
@ -18,6 +18,7 @@ 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.handler.codec.http.HttpMessage;
|
||||
import org.jboss.netty.handler.codec.http.HttpMessageEncoder;
|
||||
|
||||
@ -30,6 +31,7 @@ import org.jboss.netty.handler.codec.http.HttpMessageEncoder;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@Sharable
|
||||
public abstract class RtspMessageEncoder extends HttpMessageEncoder {
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,6 @@ import org.jboss.netty.buffer.ChannelBufferOutputStream;
|
||||
import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
/**
|
||||
@ -41,7 +40,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
*
|
||||
* @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class CompatibleObjectEncoder extends OneToOneEncoder {
|
||||
|
||||
private final AtomicReference<ChannelBuffer> buffer =
|
||||
|
@ -24,7 +24,7 @@ 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.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has org.jboss.netty.handler.codec.serialization.ObjectEncoderOutputStream - - - compatible with
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class ObjectEncoder extends OneToOneEncoder {
|
||||
private static final byte[] LENGTH_PLACEHOLDER = new byte[4];
|
||||
|
||||
|
@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
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;
|
||||
@ -59,7 +59,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class StringDecoder extends OneToOneDecoder {
|
||||
|
||||
// TODO Use CharsetDecoder instead.
|
||||
|
@ -23,7 +23,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
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;
|
||||
@ -57,7 +57,7 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class StringEncoder extends OneToOneEncoder {
|
||||
|
||||
// TODO Use CharsetEncoder instead.
|
||||
|
@ -22,10 +22,10 @@ import org.jboss.netty.channel.ChannelDownstreamHandler;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelState;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.util.ExternalResourceReleasable;
|
||||
import org.jboss.netty.util.internal.ExecutorUtil;
|
||||
|
||||
@ -106,7 +106,7 @@ import org.jboss.netty.util.internal.ExecutorUtil;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has java.util.concurrent.ThreadPoolExecutor
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class ExecutionHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler, ExternalResourceReleasable {
|
||||
|
||||
private final Executor executor;
|
||||
|
@ -22,10 +22,10 @@ import org.jboss.netty.channel.ChannelDownstreamHandler;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.logging.InternalLogLevel;
|
||||
import org.jboss.netty.logging.InternalLogger;
|
||||
import org.jboss.netty.logging.InternalLoggerFactory;
|
||||
@ -42,7 +42,7 @@ import org.jboss.netty.logging.InternalLoggerFactory;
|
||||
*
|
||||
* @apiviz.landmark
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class LoggingHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler {
|
||||
|
||||
private static final InternalLogLevel DEFAULT_LEVEL = InternalLogLevel.DEBUG;
|
||||
|
@ -23,7 +23,6 @@ import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ExceptionEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -75,7 +74,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class BlockingReadHandler<E> extends SimpleChannelUpstreamHandler {
|
||||
|
||||
private final BlockingQueue<ChannelEvent> queue;
|
||||
|
@ -20,7 +20,6 @@ import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelDownstreamHandler;
|
||||
@ -88,7 +87,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue;
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class BufferedWriteHandler extends SimpleChannelDownstreamHandler {
|
||||
|
||||
private final Queue<MessageEvent> queue;
|
||||
|
@ -27,7 +27,6 @@ import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.ChannelUpstreamHandler;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
@ -66,7 +65,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has org.jboss.netty.handler.stream.ChunkedInput oneway - - reads from
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler {
|
||||
|
||||
private static final InternalLogger logger =
|
||||
|
@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.LifeCycleAwareChannelHandler;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
@ -65,10 +64,19 @@ import org.jboss.netty.util.TimerTask;
|
||||
* <pre>
|
||||
* // An example that sends a ping message when there is no traffic
|
||||
* // (either inbound or outbound) for 30 seconds.
|
||||
* ChannelPipeline p = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* p.addLast("timeout", new IdleStateHandler(timer, 30, 30, 0));
|
||||
* p.addLast("handler", new MyHandler());
|
||||
*
|
||||
* public class MyPipelineFactory implements ChannelPipelineFactory {
|
||||
*
|
||||
* public MyPipelineFactory(Timer timer) {
|
||||
* this.timer = timer;
|
||||
* }
|
||||
*
|
||||
* public ChannelPipeline getPipeline() {
|
||||
* return Channels.pipeline(
|
||||
* new IdleStateHandler(timer, 30, 30, 0),
|
||||
* new MyHandler());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Handler should handle the IdleStateEvent triggered by IdleStateHandler.
|
||||
* public class MyHandler extends IdleStateAwareChannelHandler {
|
||||
@ -77,6 +85,11 @@ import org.jboss.netty.util.TimerTask;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ServerBootstrap bootstrap = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* ...
|
||||
* bootstrap.setPipelineFactory(new MyPipelineFactory(timer));
|
||||
* ...
|
||||
* // To shut down, call {@link #releaseExternalResources()} or {@link Timer#stop()}.
|
||||
* </pre>
|
||||
*
|
||||
@ -91,7 +104,6 @@ import org.jboss.netty.util.TimerTask;
|
||||
* @apiviz.uses org.jboss.netty.util.HashedWheelTimer
|
||||
* @apiviz.has org.jboss.netty.handler.timeout.IdleStateEvent oneway - - triggers
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class IdleStateHandler extends SimpleChannelUpstreamHandler
|
||||
implements LifeCycleAwareChannelHandler,
|
||||
ExternalResourceReleasable {
|
||||
|
@ -20,7 +20,6 @@ import static org.jboss.netty.channel.Channels.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.LifeCycleAwareChannelHandler;
|
||||
@ -37,14 +36,26 @@ import org.jboss.netty.util.TimerTask;
|
||||
* period of time.
|
||||
*
|
||||
* <pre>
|
||||
* // An example configuration that implements 30-second read timeout:
|
||||
* ChannelPipeline p = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* p.addLast("timeout", new ReadTimeoutHandler(timer, 30));
|
||||
* p.addLast("handler", new MyHandler());
|
||||
* public class MyPipelineFactory implements ChannelPipelineFactory {
|
||||
*
|
||||
* public MyPipelineFactory(Timer timer) {
|
||||
* this.timer = timer;
|
||||
* }
|
||||
*
|
||||
* public ChannelPipeline getPipeline() {
|
||||
* // An example configuration that implements 30-second read timeout:
|
||||
* return Channels.pipeline(
|
||||
* new ReadTimeoutHandler(timer, 30),
|
||||
* new MyHandler());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ServerBootstrap bootstrap = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* ...
|
||||
* bootstrap.setPipelineFactory(new MyPipelineFactory(timer));
|
||||
* ...
|
||||
* // To shut down, call {@link #releaseExternalResources()} or {@link Timer#stop()}.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
@ -57,7 +68,6 @@ import org.jboss.netty.util.TimerTask;
|
||||
* @apiviz.uses org.jboss.netty.util.HashedWheelTimer
|
||||
* @apiviz.has org.jboss.netty.handler.timeout.TimeoutException oneway - - raises
|
||||
*/
|
||||
@ChannelPipelineCoverage("one")
|
||||
public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler
|
||||
implements LifeCycleAwareChannelHandler,
|
||||
ExternalResourceReleasable {
|
||||
|
@ -22,10 +22,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelPipelineCoverage;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelDownstreamHandler;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
import org.jboss.netty.util.ExternalResourceReleasable;
|
||||
import org.jboss.netty.util.HashedWheelTimer;
|
||||
import org.jboss.netty.util.Timeout;
|
||||
@ -37,12 +37,25 @@ import org.jboss.netty.util.TimerTask;
|
||||
* certain period of time.
|
||||
*
|
||||
* <pre>
|
||||
* // An example configuration that implements 30-second write timeout:
|
||||
* ChannelPipeline p = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* p.addLast("timeout", new WriteTimeoutHandler(timer, 30));
|
||||
* p.addLast("handler", new MyHandler());
|
||||
* public class MyPipelineFactory implements ChannelPipelineFactory {
|
||||
*
|
||||
* public MyPipelineFactory(Timer timer) {
|
||||
* this.timer = timer;
|
||||
* }
|
||||
*
|
||||
* public ChannelPipeline getPipeline() {
|
||||
* // An example configuration that implements 30-second write timeout:
|
||||
* return Channels.pipeline(
|
||||
* new WriteTimeoutHandler(timer, 30),
|
||||
* new MyHandler());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ServerBootstrap bootstrap = ...;
|
||||
* Timer timer = new HashedWheelTimer();
|
||||
* ...
|
||||
* bootstrap.setPipelineFactory(new MyPipelineFactory(timer));
|
||||
* ...
|
||||
* // To shut down, call {@link #releaseExternalResources()} or {@link Timer#stop()}.
|
||||
* </pre>
|
||||
*
|
||||
@ -57,7 +70,7 @@ import org.jboss.netty.util.TimerTask;
|
||||
* @apiviz.uses org.jboss.netty.util.HashedWheelTimer
|
||||
* @apiviz.has org.jboss.netty.handler.timeout.TimeoutException oneway - - raises
|
||||
*/
|
||||
@ChannelPipelineCoverage("all")
|
||||
@Sharable
|
||||
public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
||||
implements ExternalResourceReleasable {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user