/** Init T55 server */ private void initT55Server(Properties properties) throws SQLException { String protocol = "t55"; if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); final Integer resetDelay = getProtocolResetDelay(properties, protocol); server.setPipelineFactory( new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) { protected void addSpecificHandlers(ChannelPipeline pipeline) { byte delimiter[] = {(byte) '\r', (byte) '\n'}; pipeline.addLast( "frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast( "objectDecoder", new T55ProtocolDecoder(getDataManager(), resetDelay)); } }); serverList.add(server); } }
private void initNavigilServer(String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new NavigilFrameDecoder()); pipeline.addLast("objectDecoder", new NavigilProtocolDecoder(ServerManager.this)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); serverList.add(server); } }
/** Stop */ public void stop() { for (Object server : serverList) { ((TrackerServer) server).stop(); } if (webServer != null) { webServer.stop(); } }
/** Init Meiligao server */ private void initMeiligaoServer(Properties properties) throws SQLException { String protocol = "meiligao"; if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); final Integer resetDelay = getProtocolResetDelay(properties, protocol); server.setPipelineFactory( new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 4)); pipeline.addLast( "objectDecoder", new MeiligaoProtocolDecoder(getDataManager(), resetDelay)); } }); serverList.add(server); } }
/** Stop */ public void stop() { for (Object server : serverList) { ((TrackerServer) server).stop(); } // Release resources GlobalChannelFactory.release(); GlobalTimer.release(); if (webServer != null) { webServer.stop(); } }