diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java index f77fef177f..f7fb81489c 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java @@ -40,40 +40,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * Filter pattern to give a user full control over how an event is handled * and how the {@link ChannelHandler}s in the pipeline interact with each other. * - *

Building a pipeline

- *

- * A user is supposed to have one or more {@link ChannelHandler}s in a - * pipeline to receive I/O events (e.g. read) and to request I/O operations - * (e.g. write and close). For example, a typical server will have the following - * handlers in each channel's pipeline, but your mileage may vary depending on - * the complexity and characteristics of the protocol and business logic: - * - *

    - *
  1. Protocol Decoder - translates binary data (e.g. {@link ChannelBuffer}) - * into a Java object.
  2. - *
  3. Protocol Encoder - translates a Java object into binary data.
  4. - *
  5. {@link ExecutionHandler} - applies a thread model.
  6. - *
  7. Business Logic Handler - performs the actual business logic - * (e.g. database access).
  8. - *
- * - * and it could be represented as shown in the following example: - * - *
- * ChannelPipeline pipeline = {@link Channels#pipeline() Channels.pipeline()};
- * pipeline.addLast("decoder", new MyProtocolDecoder());
- * pipeline.addLast("encoder", new MyProtocolEncoder());
- * pipeline.addLast("executor", new {@link ExecutionHandler}(new {@link OrderedMemoryAwareThreadPoolExecutor}(16, 1048576, 1048576)));
- * pipeline.addLast("handler", new MyBusinessLogicHandler());
- * 
- * - *

Thread safety

- *

- * A {@link ChannelHandler} can be added or removed at any time because a - * {@link ChannelPipeline} is thread safe. For example, you can insert a - * {@link SslHandler} when a sensitive information is about to be exchanged, - * and remove it after the exchange. - * *

How an event flows in a pipeline

*

* The following diagram describes how {@link ChannelEvent}s are processed by @@ -129,6 +95,40 @@ import org.jboss.netty.handler.ssl.SslHandler; * +----------------------------------------------------------+ * * + *

Building a pipeline

+ *

+ * A user is supposed to have one or more {@link ChannelHandler}s in a + * pipeline to receive I/O events (e.g. read) and to request I/O operations + * (e.g. write and close). For example, a typical server will have the following + * handlers in each channel's pipeline, but your mileage may vary depending on + * the complexity and characteristics of the protocol and business logic: + * + *

    + *
  1. Protocol Decoder - translates binary data (e.g. {@link ChannelBuffer}) + * into a Java object.
  2. + *
  3. Protocol Encoder - translates a Java object into binary data.
  4. + *
  5. {@link ExecutionHandler} - applies a thread model.
  6. + *
  7. Business Logic Handler - performs the actual business logic + * (e.g. database access).
  8. + *
+ * + * and it could be represented as shown in the following example: + * + *
+ * ChannelPipeline pipeline = {@link Channels#pipeline() Channels.pipeline()};
+ * pipeline.addLast("decoder", new MyProtocolDecoder());
+ * pipeline.addLast("encoder", new MyProtocolEncoder());
+ * pipeline.addLast("executor", new {@link ExecutionHandler}(new {@link OrderedMemoryAwareThreadPoolExecutor}(16, 1048576, 1048576)));
+ * pipeline.addLast("handler", new MyBusinessLogicHandler());
+ * 
+ * + *

Thread safety

+ *

+ * A {@link ChannelHandler} can be added or removed at any time because a + * {@link ChannelPipeline} is thread safe. For example, you can insert a + * {@link SslHandler} when a sensitive information is about to be exchanged, + * and remove it after the exchange. + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com) *