diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-12 13:05:10 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-12 13:05:10 +1200 |
commit | f304021d16e433b261226a8293f03e7de30a08a4 (patch) | |
tree | bb908a0e437a4d80b7e5043346545d02e8b235af /src/org/traccar/BasePipelineFactory.java | |
parent | 639b427eba5738534c10f591e285d707e8b060e5 (diff) | |
download | trackermap-server-f304021d16e433b261226a8293f03e7de30a08a4.tar.gz trackermap-server-f304021d16e433b261226a8293f03e7de30a08a4.tar.bz2 trackermap-server-f304021d16e433b261226a8293f03e7de30a08a4.zip |
Re-factor all channel handlers
Diffstat (limited to 'src/org/traccar/BasePipelineFactory.java')
-rw-r--r-- | src/org/traccar/BasePipelineFactory.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index c4ca8f47c..4ff4030f0 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -18,7 +18,16 @@ package org.traccar; import java.net.InetSocketAddress; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.*; +import org.jboss.netty.channel.ChannelEvent; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.ChannelPipelineFactory; +import org.jboss.netty.channel.ChannelStateEvent; +import org.jboss.netty.channel.Channels; +import org.jboss.netty.channel.DownstreamMessageEvent; +import org.jboss.netty.channel.ExceptionEvent; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.channel.SimpleChannelHandler; import org.jboss.netty.handler.logging.LoggingHandler; import org.jboss.netty.handler.timeout.IdleStateHandler; import org.traccar.helper.Log; @@ -57,13 +66,13 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { msg.append("[").append(String.format("%08X", e.getChannel().getId())).append(": "); msg.append(((InetSocketAddress) e.getChannel().getLocalAddress()).getPort()); - msg.append((e instanceof DownstreamMessageEvent) ? " -> " : " <- "); + msg.append((e instanceof DownstreamMessageEvent) ? " > " : " < "); msg.append(((InetSocketAddress) event.getRemoteAddress()).getAddress().getHostAddress()).append("]"); // Append hex message if (event.getMessage() instanceof ChannelBuffer) { - msg.append(" - HEX: "); + msg.append(" HEX: "); msg.append(ChannelBuffers.hexDump((ChannelBuffer) event.getMessage())); } @@ -116,7 +125,7 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { pipeline.addLast("geocoder", new ReverseGeocoderHandler(Context.getReverseGeocoder(), processInvalidPositions)); } pipeline.addLast("remoteAddress", new RemoteAddressHandler()); - pipeline.addLast("handler", new TrackerEventHandler()); + pipeline.addLast("handler", new MainEventHandler()); return pipeline; } |