Exemplo n.º 1
0
  public static void main(String[] args) {
    int port;
    if (args.length > 0) {
      port = Integer.parseInt(args[0]);
    } else {
      port = 8081;
    }
    RpcServer rpcServer = new RpcServer();
    rpcServer.start("localhost", port);

    StatisticsPublishingService publishingService = new NettyStatisticsPublishingService(rpcServer);

    TimeIntervalCollectorsFactory collectorsFactory =
        new TimeIntervalCollectorsFactory(
            new JdkTimerScheduler(), new DefaultStatisticsPublisherJobFactory(publishingService));
    TimingPointsCollector timingPointsCollector = collectorsFactory.forIntervals(TimeUnit.SECONDS);

    TimingPointServiceHandlers.bindHandlers(
        rpcServer, new InMemoryStatisticsServerFacade(timingPointsCollector));
  }