当前位置: 首页>>代码示例>>Java>>正文


Java OstrichStatsReceiver类代码示例

本文整理汇总了Java中com.twitter.finagle.stats.OstrichStatsReceiver的典型用法代码示例。如果您正苦于以下问题:Java OstrichStatsReceiver类的具体用法?Java OstrichStatsReceiver怎么用?Java OstrichStatsReceiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OstrichStatsReceiver类属于com.twitter.finagle.stats包,在下文中一共展示了OstrichStatsReceiver类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startThriftServer

import com.twitter.finagle.stats.OstrichStatsReceiver; //导入依赖的package包/类
private void startThriftServer(int thriftPort) throws UnknownHostException {
  TerrapinController.ServiceIface serviceImpl = new TerrapinControllerServiceImpl(
      this.configuration,
      this.zkManager,
      this.hdfsClient,
      this.helixAdmin,
      this.clusterName);
  TerrapinController.Service service =
      new TerrapinController.Service(serviceImpl, new TBinaryProtocol.Factory());

  this.server = ServerBuilder.safeBuild(
      service,
      ServerBuilder.get()
      .name("TerrapinController")
      .codec(ThriftServerFramedCodec.get())
      .hostConnectionMaxIdleTime(Duration.fromTimeUnit(
          configuration.getInt(Constants.THRIFT_CONN_MAX_IDLE_TIME, 1), TimeUnit.MINUTES))
      .maxConcurrentRequests(configuration.getInt(Constants.THRIFT_MAX_CONCURRENT_REQUESTS,
          100))
      .reportTo(new OstrichStatsReceiver(Stats.get("")))
      .bindTo(new InetSocketAddress(thriftPort)));
  new OstrichAdminService(configuration.getInt(Constants.OSTRICH_METRICS_PORT, 9999)).start();
}
 
开发者ID:pinterest-attic,项目名称:terrapin,代码行数:24,代码来源:TerrapinControllerHandler.java

示例2: main

import com.twitter.finagle.stats.OstrichStatsReceiver; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  final PropertiesConfiguration config = TerrapinUtil.readPropertiesExitOnFailure(
      System.getProperties().getProperty("terrapin.config", "thrift.properties"));

  OstrichStatsReceiver statsReceiver = new OstrichStatsReceiver(Stats.get(""));
  int listenPort = config.getInt("thrift_port", 9090);
  TerrapinServiceImpl serviceImpl = new TerrapinServiceImpl(config,
      (List) config.getList("cluster_list"));
  Service<byte[], byte[]> service = new TerrapinService.Service(serviceImpl,
      new TBinaryProtocol.Factory());
  Server server = ServerBuilder.safeBuild(
      service,
      ServerBuilder.get()
          .name("TERRAPIN_THRIFT")
          .codec(ThriftServerFramedCodec.get())
          .hostConnectionMaxIdleTime(Duration.apply(1, TimeUnit.MINUTES))
          .maxConcurrentRequests(3000)
          .reportTo(statsReceiver)
          .bindTo(new InetSocketAddress(listenPort)));
  new OstrichAdminService(config.getInt(Constants.OSTRICH_METRICS_PORT, 9999)).start();
  LOG.info("\n#######################################"
          + "\n#      Ready To Serve Requests.       #"
          + "\n#######################################");
}
 
开发者ID:pinterest-attic,项目名称:terrapin,代码行数:25,代码来源:TerrapinThriftMain.java

示例3: startThriftServer

import com.twitter.finagle.stats.OstrichStatsReceiver; //导入依赖的package包/类
private void startThriftServer(int thriftPort) {
  TerrapinServerInternal.ServiceIface serviceImpl = new TerrapinServerInternalImpl(configuration,
      resourcePartitionMap);
  TerrapinServerInternal.Service service =
      new TerrapinServerInternal.Service(serviceImpl, new TBinaryProtocol.Factory());

  this.server = ServerBuilder.safeBuild(
      service,
      ServerBuilder.get()
          .name("TerrapinServer")
          .codec(ThriftServerFramedCodec.get())
          .hostConnectionMaxIdleTime(Duration.fromTimeUnit(
                  configuration.getInt(Constants.THRIFT_CONN_MAX_IDLE_TIME, 1), TimeUnit.MINUTES))
          .maxConcurrentRequests(configuration.getInt(Constants.THRIFT_MAX_CONCURRENT_REQUESTS,
                  100))
          .reportTo(new OstrichStatsReceiver(Stats.get("")))
          .bindTo(new InetSocketAddress(thriftPort)));
    new OstrichAdminService(configuration.getInt(Constants.OSTRICH_METRICS_PORT, 9999)).start();  
}
 
开发者ID:pinterest-attic,项目名称:terrapin,代码行数:20,代码来源:TerrapinServerHandler.java

示例4: main

import com.twitter.finagle.stats.OstrichStatsReceiver; //导入依赖的package包/类
public static void main(String[] args) {
  try {
    String serverHostName = InetAddress.getLocalHost().getHostName();
    PinLaterQueueConfig queueConfig = new PinLaterQueueConfig(CONFIGURATION);
    queueConfig.initialize();
    String backend = CONFIGURATION.getString("PINLATER_BACKEND");
    PinLaterBackendIface backendIFace = getBackendIface(backend, serverHostName);
    PinLaterServiceImpl serviceImpl = new PinLaterServiceImpl(backendIFace, queueConfig);
    PinLater.Service service = new PinLater.Service(serviceImpl, new TBinaryProtocol.Factory());
    ServiceShutdownHook.register(ServerBuilder.safeBuild(
        service,
        ServerBuilder.get()
            .name("PinLaterService")
            .codec(ThriftServerFramedCodec.get())
            .hostConnectionMaxIdleTime(Duration.fromTimeUnit(
                CONFIGURATION.getInt("SERVER_CONN_MAX_IDLE_TIME_MINUTES"), TimeUnit.MINUTES))
            .maxConcurrentRequests(CONFIGURATION.getInt("MAX_CONCURRENT_REQUESTS"))
            .reportTo(new OstrichStatsReceiver(Stats.get("")))
            .bindTo(new InetSocketAddress(CONFIGURATION.getInt("THRIFT_PORT")))));
    new OstrichAdminService(CONFIGURATION.getInt("OSTRICH_PORT")).start();

    LOG.info("\n#######################################"
        + "\n#      Ready To Serve Requests.       #"
        + "\n#######################################");
  } catch (Exception e) {
    LOG.error("Failed to start the pinlater server", e);
    System.exit(1);
  }
}
 
开发者ID:pinterest-attic,项目名称:pinlater,代码行数:30,代码来源:PinLaterServer.java


注:本文中的com.twitter.finagle.stats.OstrichStatsReceiver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。