Class LocalTimeClientHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.example.localtime.LocalTimeClientHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler
public class LocalTimeClientHandler extends SimpleChannelUpstreamHandler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.BlockingQueue<LocalTimeProtocol.LocalTimes>answerprivate Channelchannelprivate static java.util.regex.PatternDELIM
-
Constructor Summary
Constructors Constructor Description LocalTimeClientHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannelis open, but not bound nor connected.voidexceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)Invoked when an exception was raised by an I/O thread or aChannelHandler.java.util.List<java.lang.String>getLocalTimes(java.util.Collection<java.lang.String> cities)voidhandleUpstream(ChannelHandlerContext ctx, ChannelEvent e)Handles the specified upstream event.voidmessageReceived(ChannelHandlerContext ctx, MessageEvent e)Invoked when a message object (e.g:ChannelBuffer) was received from a remote peer.-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, writeComplete
-
-
-
-
Field Detail
-
DELIM
private static final java.util.regex.Pattern DELIM
-
channel
private volatile Channel channel
-
answer
private final java.util.concurrent.BlockingQueue<LocalTimeProtocol.LocalTimes> answer
-
-
Method Detail
-
getLocalTimes
public java.util.List<java.lang.String> getLocalTimes(java.util.Collection<java.lang.String> cities)
-
handleUpstream
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerHandles the specified upstream event. Down-casts the received upstream event into more meaningful sub-type event and calls an appropriate handler method with the down-casted event.- Specified by:
handleUpstreamin interfaceChannelUpstreamHandler- Overrides:
handleUpstreamin classSimpleChannelUpstreamHandler- Parameters:
ctx- the context object for this handlere- the upstream event to process or intercept- Throws:
java.lang.Exception
-
channelOpen
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelis open, but not bound nor connected.
Be aware that this event is fired from within the I/O thread. You should never execute any heavy operation in there as it will block the dispatching to other workers!- Overrides:
channelOpenin classSimpleChannelUpstreamHandler- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.- Overrides:
messageReceivedin classSimpleChannelUpstreamHandler
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler
-
-