Revised the documentation about event flow
This commit is contained in:
parent
5814ec65a4
commit
b9c8675cf1
@ -20,15 +20,13 @@ import java.net.SocketAddress;
|
||||
|
||||
/**
|
||||
* Handles or intercepts a downstream {@link ChannelEvent}, and sends a
|
||||
* {@link ChannelEvent} to the previous or next handler in a
|
||||
* {@link ChannelPipeline}.
|
||||
* {@link ChannelEvent} to the next handler in a {@link ChannelPipeline}.
|
||||
*
|
||||
* <h3>Downstream events</h3>
|
||||
* <p>
|
||||
* A downstream event is an event which is supposed to be processed from the
|
||||
* last handler to the first handler in a {@link ChannelPipeline}.
|
||||
* For example, all I/O requests made by a user application are downstream
|
||||
* events.
|
||||
* A downstream event is an event which is supposed to be processed by
|
||||
* a series of downstream handlers in the {@link ChannelPipeline}. It is often
|
||||
* an I/O request made by a user application.
|
||||
* <p>
|
||||
* The most common use case of this interface is to intercept an I/O request
|
||||
* such as {@link Channel#write(Object)} and {@link Channel#close()}. The
|
||||
@ -83,22 +81,21 @@ import java.net.SocketAddress;
|
||||
* out what an upstream event and a downstream event are, what fundamental
|
||||
* differences they have, and how they flow in a pipeline.
|
||||
*
|
||||
* <h3>Firing an event to the previous or next handler</h3>
|
||||
* <h3>Firing an event to the next handler</h3>
|
||||
* <p>
|
||||
* You can forward the received event downstream or upstream. In most cases,
|
||||
* {@link ChannelDownstreamHandler} will pass the event to the previous
|
||||
* handler (downstream) although it is legal to pass the event to the next
|
||||
* handler (upstream):
|
||||
* {@link ChannelDownstreamHandler} will send the event downstream
|
||||
* (i.e. outbound) although it is legal to send the event upstream (i.e. inbound):
|
||||
*
|
||||
* <pre>
|
||||
* // Sending the event forward (downstream)
|
||||
* // Sending the event downstream (outbound)
|
||||
* void handleDownstream({@link ChannelHandlerContext} ctx, {@link ChannelEvent} e) throws Exception {
|
||||
* ...
|
||||
* ctx.sendDownstream(e);
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* // Sending the event backward (upstream)
|
||||
* // Sending the event upstream (inbound)
|
||||
* void handleDownstream({@link ChannelHandlerContext} ctx, {@link ChannelEvent} e) throws Exception {
|
||||
* ...
|
||||
* ctx.sendUpstream(new DefaultChannelStateEvent(...));
|
||||
|
@ -25,13 +25,13 @@ package org.jboss.netty.channel;
|
||||
*
|
||||
* <h3>Upstream events and downstream events, and their interpretation</h3>
|
||||
* <p>
|
||||
* Every event can be either an upstream event or a downstream event.
|
||||
* If an event flows from the first handler to the last handler in a
|
||||
* Every event is either an upstream event or a downstream event.
|
||||
* If an event flows forward from the first handler to the last handler in a
|
||||
* {@link ChannelPipeline}, we call it an upstream event and say <strong>"an
|
||||
* event goes upstream."</strong> If an event flows from the last handler to
|
||||
* the first handler in a {@link ChannelPipeline}, we call it a downstream
|
||||
* event and say <strong>"an event goes downstream."</strong> (Please refer
|
||||
* to the diagram in {@link ChannelPipeline} for more explanation.)
|
||||
* event goes upstream."</strong> If an event flows backward from the last
|
||||
* handler to the first handler in a {@link ChannelPipeline}, we call it a
|
||||
* downstream event and say <strong>"an event goes downstream."</strong>
|
||||
* (Please refer to the diagram in {@link ChannelPipeline} for more explanation.)
|
||||
* <p>
|
||||
* A {@link ChannelEvent} is interpreted differently by a {@link ChannelHandler}
|
||||
* depending on whether the event is an upstream event or a downstream event.
|
||||
|
@ -17,8 +17,7 @@ package org.jboss.netty.channel;
|
||||
|
||||
/**
|
||||
* Handles or intercepts a {@link ChannelEvent}, and sends a
|
||||
* {@link ChannelEvent} to the next or previous handler in a
|
||||
* {@link ChannelPipeline}.
|
||||
* {@link ChannelEvent} to the next handler in a {@link ChannelPipeline}.
|
||||
*
|
||||
* <h3>Sub-types</h3>
|
||||
* <p>
|
||||
@ -40,9 +39,9 @@ package org.jboss.netty.channel;
|
||||
* A {@link ChannelHandler} is provided with a {@link ChannelHandlerContext}
|
||||
* object. A {@link ChannelHandler} is supposed to interact with the
|
||||
* {@link ChannelPipeline} it belongs to via a context object. Using the
|
||||
* context object, the {@link ChannelHandler} can pass events to the next
|
||||
* or the previous handler or modify the behavior of the pipeline, or store the
|
||||
* information (attachment) which is specific to the handler.
|
||||
* context object, the {@link ChannelHandler} can pass events upstream or
|
||||
* downstream, modify the behavior of the pipeline, or store the information
|
||||
* (attachment) which is specific to the handler.
|
||||
*
|
||||
* <h3>Additional resources worth reading</h3>
|
||||
* <p>
|
||||
|
@ -19,9 +19,9 @@ package org.jboss.netty.channel;
|
||||
* Provides the properties and operations which are specific to a
|
||||
* {@link ChannelHandler} and the {@link ChannelPipeline} it belongs to.
|
||||
* Via a {@link ChannelHandlerContext}, a {@link ChannelHandler} can send
|
||||
* an upstream or downstream {@link ChannelEvent} to the next or previous
|
||||
* {@link ChannelHandler} in a pipeline, modify the behavior of the pipeline,
|
||||
* or store the information (attachment) which is specific to the handler.
|
||||
* a {@link ChannelEvent} upstream or downstream, modify the behavior of the
|
||||
* pipeline, or store the information (attachment) which is specific to the
|
||||
* handler.
|
||||
* <pre>
|
||||
* <b>n</b> = the number of the handler entries in a pipeline
|
||||
*
|
||||
@ -128,18 +128,20 @@ public interface ChannelHandlerContext {
|
||||
boolean canHandleDownstream();
|
||||
|
||||
/**
|
||||
* Sends the specified {@link ChannelEvent} to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline}. It is
|
||||
* recommended to use the event generation methods in {@link Channels}
|
||||
* rather than calling this method directly.
|
||||
* Sends the specified {@link ChannelEvent} to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with this context. It is recommended to use
|
||||
* the shortcut methods in {@link Channels} rather than calling this method
|
||||
* directly.
|
||||
*/
|
||||
void sendUpstream(ChannelEvent e);
|
||||
|
||||
/**
|
||||
* Sends the specified {@link ChannelEvent} to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline}. It is
|
||||
* recommended to use the event generation methods in {@link Channels}
|
||||
* rather than calling this method directly.
|
||||
* Sends the specified {@link ChannelEvent} to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with this context. It is
|
||||
* recommended to use the shortcut methods in {@link Channels} rather than
|
||||
* calling this method directly.
|
||||
*/
|
||||
void sendDownstream(ChannelEvent e);
|
||||
|
||||
|
@ -47,62 +47,60 @@ import org.jboss.netty.handler.ssl.SslHandler;
|
||||
* The following diagram describes how {@link ChannelEvent}s are processed by
|
||||
* {@link ChannelHandler}s in a {@link ChannelPipeline} typically.
|
||||
* A {@link ChannelEvent} can be handled by either a {@link ChannelUpstreamHandler}
|
||||
* or a {@link ChannelDownstreamHandler} and be forwarded to the next or
|
||||
* previous handler by calling {@link ChannelHandlerContext#sendUpstream(ChannelEvent)}
|
||||
* or a {@link ChannelDownstreamHandler} and be forwarded to the closest
|
||||
* handler by calling {@link ChannelHandlerContext#sendUpstream(ChannelEvent)}
|
||||
* or {@link ChannelHandlerContext#sendDownstream(ChannelEvent)}. The meaning
|
||||
* of the event is interpreted somewhat differently depending on whether it is
|
||||
* going upstream or going downstream. Please refer to {@link ChannelEvent} for
|
||||
* more information.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* I/O Request
|
||||
* via {@link Channel} or
|
||||
* {@link ChannelHandlerContext}
|
||||
* |
|
||||
* +---------------------------------------------+--------------------+
|
||||
* | ChannelPipeline | |
|
||||
* | \|/ |
|
||||
* | +----------------------+ +-----------+------------+ |
|
||||
* | LAST | Upstream Handler N | | Downstream Handler M | LAST |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | . /|\ | . |
|
||||
* | . | \|/ . |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | . | Upstream Handler N-1 | | Downstream Handler M-1 | . |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | . /|\ . . |
|
||||
* | . . . . |
|
||||
* | . [ Going UPSTREAM ] [ Going DOWNSTREAM ] . |
|
||||
* | . [ + INBOUND data ] [ + OUTBOUND data ] . |
|
||||
* | . . . . |
|
||||
* | . . \|/ . |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | . | Upstream Handler 2 | | Downstream Handler 2 | . |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | . /|\ | . |
|
||||
* | . | \|/ . |
|
||||
* | . +----------+-----------+ +-----------+------------+ . |
|
||||
* | FIRST | Upstream Handler 1 | | Downstream Handler 1 | FIRST |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | /|\ | |
|
||||
* +------------------+--------------------------+--------------------+
|
||||
* | \|/
|
||||
* +------------------+--------------------------+--------------------+
|
||||
* | Netty Internal I/O Threads (Transport Implementation) |
|
||||
* +------------------------------------------------------------------+
|
||||
* I/O Request
|
||||
* via {@link Channel} or
|
||||
* {@link ChannelHandlerContext}
|
||||
* |
|
||||
* +----------------------------------------+---------------+
|
||||
* | ChannelPipeline | |
|
||||
* | \|/ |
|
||||
* | +----------------------+ +-----------+------------+ |
|
||||
* | | Upstream Handler N | | Downstream Handler 1 | |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | /|\ | |
|
||||
* | | \|/ |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | | Upstream Handler N-1 | | Downstream Handler 2 | |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | /|\ . |
|
||||
* | . . |
|
||||
* | [ sendUpstream() ] [ sendDownstream() ] |
|
||||
* | [ + INBOUND data ] [ + OUTBOUND data ] |
|
||||
* | . . |
|
||||
* | . \|/ |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | | Upstream Handler 2 | | Downstream Handler M-1 | |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | /|\ | |
|
||||
* | | \|/ |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | | Upstream Handler 1 | | Downstream Handler M | |
|
||||
* | +----------+-----------+ +-----------+------------+ |
|
||||
* | /|\ | |
|
||||
* +-------------+--------------------------+---------------+
|
||||
* | \|/
|
||||
* +-------------+--------------------------+---------------+
|
||||
* | Netty Internal I/O Threads (Transport Implementation) |
|
||||
* +--------------------------------------------------------+
|
||||
* </pre>
|
||||
* An upstream event flows from the first upstream handler to the last upstream
|
||||
* handler as shown on the left side of the diagram. An upstream handler
|
||||
* An upstream event is handled by the upstream handlers in the bottom-up
|
||||
* direction as shown on the left side of the diagram. An upstream handler
|
||||
* usually handles the inbound data received from the I/O thread on the bottom
|
||||
* of the diagram. If an upstream event goes beyond the last upstream handler,
|
||||
* of the diagram. If an upstream event goes beyond the top upstream handler,
|
||||
* it is discarded silently.
|
||||
* <p>
|
||||
* A downstream event flows from the last downstream handler to the first
|
||||
* downstream handler as shown on the right side of the diagram. A downstream
|
||||
* handler usually generates or transforms the outbound traffic such as write
|
||||
* requests. If a downstream event goes beyond the first downstream handler,
|
||||
* it is handled by an I/O thread associated with the {@link Channel}.
|
||||
* A downstream event is handled by the downstream handler in the top-down
|
||||
* direction as shown on the right side of the diagram. A downstream handler
|
||||
* usually generates or transforms the outbound traffic such as write requests.
|
||||
* If a downstream event goes beyond the bottom downstream handler, it is
|
||||
* handled by an I/O thread associated with the {@link Channel}.
|
||||
* <p>
|
||||
* For example, let us assume that we created the following pipeline:
|
||||
* <pre>
|
||||
|
@ -26,15 +26,14 @@ import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* Handles or intercepts an upstream {@link ChannelEvent}, and sends a
|
||||
* {@link ChannelEvent} to the next or previous handler in a
|
||||
* {@link ChannelPipeline}.
|
||||
* {@link ChannelEvent} to the next handler in a {@link ChannelPipeline}.
|
||||
*
|
||||
* <h3>Upstream events</h3>
|
||||
* <p>
|
||||
* An upstream event is an event which is supposed to be processed from the
|
||||
* first handler to the last handler in the {@link ChannelPipeline}.
|
||||
* For example, all events initiated by an I/O thread are upstream events, and
|
||||
* they have the following meaning:
|
||||
* An upstream event is an event which is supposed to be processed by
|
||||
* a series of upstream handlers in the the {@link ChannelPipeline}.
|
||||
* The upstream events are generated by an I/O thread, and they have the
|
||||
* following meaning:
|
||||
* <p>
|
||||
* <table border="1" cellspacing="0" cellpadding="6">
|
||||
* <tr>
|
||||
@ -127,22 +126,21 @@ import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
|
||||
* directly though if you want to handle various types of events in more
|
||||
* generic way.
|
||||
*
|
||||
* <h3>Firing an event to the next or previous handler</h3>
|
||||
* <h3>Firing an event to the next handler</h3>
|
||||
* <p>
|
||||
* You can forward the received event upstream or downstream. In most cases,
|
||||
* {@link ChannelUpstreamHandler} will sent the event to the next handler
|
||||
* (upstream) although it is legal to sent the event to the previous handler
|
||||
* (downstream):
|
||||
* {@link ChannelUpstreamHandler} will send the event upstream (i.e. inbound)
|
||||
* although it is legal to send the event downstream (i.e. outbound):
|
||||
*
|
||||
* <pre>
|
||||
* // Sending the event forward (upstream)
|
||||
* // Sending the event upstream (inbound)
|
||||
* void handleUpstream({@link ChannelHandlerContext} ctx, {@link ChannelEvent} e) throws Exception {
|
||||
* ...
|
||||
* ctx.sendUpstream(e);
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* // Sending the event backward (downstream)
|
||||
* // Sending the event downstream (outbound)
|
||||
* void handleDownstream({@link ChannelHandlerContext} ctx, {@link ChannelEvent} e) throws Exception {
|
||||
* ...
|
||||
* ctx.sendDownstream(new MessageEvent(...));
|
||||
|
@ -193,11 +193,14 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelOpen"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs. Please note that
|
||||
* this method does not send a {@code "childChannelOpen"} event unlike
|
||||
* {@link #fireChannelOpen(Channel)} method.
|
||||
* Sends a {@code "channelOpen"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
* <p>
|
||||
* Please note that this method does not trigger a
|
||||
* {@code "childChannelOpen"} event unlike {@link #fireChannelOpen(Channel)}
|
||||
* method.
|
||||
*/
|
||||
public static void fireChannelOpen(ChannelHandlerContext ctx) {
|
||||
ctx.sendUpstream(new UpstreamChannelStateEvent(
|
||||
@ -207,11 +210,14 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelOpen(ChannelHandlerContext)} instead.
|
||||
*
|
||||
* Sends a {@code "channelOpen"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs. Please note that
|
||||
* this method does not send a {@code "childChannelOpen"} event unlike
|
||||
* {@link #fireChannelOpen(Channel)} method.
|
||||
* Sends a {@code "channelOpen"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
* <p>
|
||||
* Please note that this method does not trigger a
|
||||
* {@code "childChannelOpen"} event unlike {@link #fireChannelOpen(Channel)}
|
||||
* method.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelOpen(
|
||||
@ -235,9 +241,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelBound"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelBound"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param localAddress
|
||||
* the local address where the specified channel is bound
|
||||
@ -250,9 +257,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelBound(ChannelHandlerContext, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "channelBound"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelBound"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param localAddress
|
||||
* the local address where the specified channel is bound
|
||||
@ -280,9 +288,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelConnected"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelConnected"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param remoteAddress
|
||||
* the remote address where the specified channel is connected
|
||||
@ -296,9 +305,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelConnected(ChannelHandlerContext, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "channelConnected"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelConnected"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param remoteAddress
|
||||
* the remote address where the specified channel is connected
|
||||
@ -337,9 +347,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "messageReceived"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "messageReceived"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param message the received message
|
||||
*/
|
||||
@ -350,9 +361,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireMessageReceived(ChannelHandlerContext, Object)} instead.
|
||||
*
|
||||
* Sends a {@code "messageReceived"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "messageReceived"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param message the received message
|
||||
*/
|
||||
@ -365,9 +377,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "messageReceived"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "messageReceived"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param message the received message
|
||||
* @param remoteAddress the remote address where the received message
|
||||
@ -382,9 +395,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireMessageReceived(ChannelHandlerContext, Object, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "messageReceived"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "messageReceived"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param message the received message
|
||||
* @param remoteAddress the remote address where the received message
|
||||
@ -413,9 +427,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "writeComplete"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "writeComplete"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireWriteComplete(ChannelHandlerContext ctx, int amount) {
|
||||
ctx.sendUpstream(new DefaultWriteCompletionEvent(ctx.getChannel(), amount));
|
||||
@ -447,9 +462,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelInterestChanged"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelInterestChanged"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireChannelInterestChanged(
|
||||
ChannelHandlerContext ctx) {
|
||||
@ -462,9 +478,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelInterestChanged(ChannelHandlerContext)} instead.
|
||||
*
|
||||
* Sends a {@code "channelInterestChanged"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelInterestChanged"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param channel the {@link Channel}
|
||||
* @param interestOps the new interestOps
|
||||
@ -488,9 +505,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelDisconnected"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelDisconnected"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireChannelDisconnected(ChannelHandlerContext ctx) {
|
||||
ctx.sendUpstream(new UpstreamChannelStateEvent(
|
||||
@ -500,9 +518,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelDisconnected(ChannelHandlerContext)} instead.
|
||||
*
|
||||
* Sends a {@code "channelDisconnected"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelDisconnected"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelDisconnected(
|
||||
@ -522,9 +541,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelUnbound"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelUnbound"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireChannelUnbound(ChannelHandlerContext ctx) {
|
||||
|
||||
@ -535,9 +555,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelUnbound(ChannelHandlerContext)} instead.
|
||||
*
|
||||
* Sends a {@code "channelUnbound"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelUnbound"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelUnbound(
|
||||
@ -563,9 +584,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelClosed"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelClosed"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireChannelClosed(ChannelHandlerContext ctx) {
|
||||
ctx.sendUpstream(
|
||||
@ -576,9 +598,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelClosed(ChannelHandlerContext)}.
|
||||
*
|
||||
* Sends a {@code "channelClosed"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "channelClosed"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelClosed(
|
||||
@ -598,9 +621,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "exceptionCaught"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "exceptionCaught"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
public static void fireExceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
ctx.sendUpstream(new DefaultExceptionEvent(ctx.getChannel(), cause));
|
||||
@ -609,9 +633,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #fireExceptionCaught(ChannelHandlerContext, Throwable)} instead.
|
||||
*
|
||||
* Sends a {@code "exceptionCaught"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "exceptionCaught"} event to the
|
||||
* {@link ChannelUpstreamHandler} which is placed in the closest upstream
|
||||
* from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireExceptionCaught(
|
||||
@ -649,9 +674,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "bind"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "bind"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the bind
|
||||
@ -670,9 +696,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #bind(ChannelHandlerContext, ChannelFuture, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "bind"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "bind"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to bind
|
||||
@ -688,9 +715,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "unbind"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "unbind"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the unbind
|
||||
@ -704,9 +732,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #unbind(ChannelHandlerContext, ChannelFuture)} instead.
|
||||
*
|
||||
* Sends a {@code "unbind"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "unbind"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to unbind
|
||||
@ -758,9 +787,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "connect"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "connect"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the connection
|
||||
@ -779,9 +809,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #connect(ChannelHandlerContext, ChannelFuture, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "connect"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "connect"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to attempt a connection
|
||||
@ -812,9 +843,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "write"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "write"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the write
|
||||
@ -828,9 +860,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #write(ChannelHandlerContext, ChannelFuture, Object)} instead.
|
||||
*
|
||||
* Sends a {@code "write"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "write"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to write a message
|
||||
@ -865,9 +898,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "write"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "write"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the write
|
||||
@ -886,9 +920,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #write(ChannelHandlerContext, ChannelFuture, Object, SocketAddress)} instead.
|
||||
*
|
||||
* Sends a {@code "write"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "write"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to write a message
|
||||
@ -927,9 +962,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "setInterestOps"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "setInterestOps"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified when the interestOps is
|
||||
@ -949,9 +985,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #setInterestOps(ChannelHandlerContext, ChannelFuture, int)} instead.
|
||||
*
|
||||
* Sends a {@code "setInterestOps"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "setInterestOps"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to change the interestOps
|
||||
@ -982,9 +1019,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "disconnect"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "disconnect"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified on disconnection
|
||||
@ -998,9 +1036,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #disconnect(ChannelHandlerContext, ChannelFuture)} instead.
|
||||
*
|
||||
* Sends a {@code "disconnect"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "disconnect"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to disconnect
|
||||
@ -1029,9 +1068,10 @@ public class Channels {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "close"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "close"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param future the future which will be notified on closure
|
||||
@ -1045,9 +1085,10 @@ public class Channels {
|
||||
/**
|
||||
* @deprecated Use {@link #close(ChannelHandlerContext, ChannelFuture)} instead.
|
||||
*
|
||||
* Sends a {@code "close"} request to the previous
|
||||
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
* Sends a {@code "close"} request to the
|
||||
* {@link ChannelDownstreamHandler} which is placed in the closest
|
||||
* downstream from the handler associated with the specified
|
||||
* {@link ChannelHandlerContext}.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param channel the channel to close
|
||||
|
Loading…
x
Reference in New Issue
Block a user