示例#1
0
  /** 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);
    }
  }
示例#2
0
 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);
   }
 }
示例#3
0
 /** Stop */
 public void stop() {
   for (Object server : serverList) {
     ((TrackerServer) server).stop();
   }
   if (webServer != null) {
     webServer.stop();
   }
 }
示例#4
0
  /** 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);
    }
  }
示例#5
0
  /** Stop */
  public void stop() {
    for (Object server : serverList) {
      ((TrackerServer) server).stop();
    }

    // Release resources
    GlobalChannelFactory.release();
    GlobalTimer.release();

    if (webServer != null) {
      webServer.stop();
    }
  }