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


Java HostAndPort.toString方法代码示例

本文整理汇总了Java中com.google.common.net.HostAndPort.toString方法的典型用法代码示例。如果您正苦于以下问题:Java HostAndPort.toString方法的具体用法?Java HostAndPort.toString怎么用?Java HostAndPort.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.net.HostAndPort的用法示例。


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

示例1: get

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Override
public PushGateway get() {
    final HostAndPort address = configuration.getAddress().withDefaultPort(9091);

    return new PushGateway(address.toString());
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:7,代码来源:PushGatewayProvider.java

示例2: createLeaderWrapper

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
private boolean createLeaderWrapper(String leaderUrlStr) {
  try {
    URL tURL = new URL(leaderUrlStr);
    HostAndPort newLeader = HostAndPort.fromParts(tURL.getHost(), tURL.getPort());
    leaderUrlStr = newLeader.toString();
    if (leaderWrapper != null && leaderUrlStr.equals(leaderWrapper.getLeaderInfo())) {
      return true;
    }

    // create new Leader
    ManagedChannel clientChannel = session.getChannel(leaderUrlStr);
    leaderWrapper =
      new LeaderWrapper(
          leaderUrlStr,
          PDGrpc.newBlockingStub(clientChannel),
          PDGrpc.newStub(clientChannel),
          System.nanoTime());
  } catch (MalformedURLException e) {
    logger.error("Error updating leader.", e);
    return false;
  }
  logger.info(String.format("Switched to new leader: %s", leaderWrapper));
  return true;
}
 
开发者ID:pingcap,项目名称:tikv-client-lib-java,代码行数:25,代码来源:PDClient.java

示例3: MigratorMonitor

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
public MigratorMonitor(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort,
                       final ScanWorkflow workflow, final MigratorStatusDAO statusDAO,
                       final DataTools dataTools, LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask,
                       MetricRegistry metricRegistry) {
    super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES,
            new Supplier<Service>() {
                @Override
                public Service get() {
                    return new LocalMigratorMonitor(workflow, statusDAO, dataTools);
                }
            });

    ServiceFailureListener.listenTo(this, metricRegistry);
    leaderServiceTask.register(SERVICE_NAME, this);
    lifecycle.manage(new ManagedGuavaService(this));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:18,代码来源:MigratorMonitor.java

示例4: ScanUploadSchedulingService

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
public ScanUploadSchedulingService(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort,
                                   final ScanUploader scanUploader, final List<ScheduledDailyScanUpload> scheduledScans,
                                   final ScanCountListener scanCountListener, final StashRequestManager stashRequestManager,
                                   LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask,
                                   final MetricRegistry metricRegistry,
                                   final Clock clock) {
    super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES,
            new Supplier<Service>() {
                @Override
                public Service get() {
                    return new DelegateSchedulingService(scanUploader, stashRequestManager, scheduledScans, scanCountListener, clock);
                }
            });

    ServiceFailureListener.listenTo(this, metricRegistry);
    leaderServiceTask.register(SERVICE_NAME, this);
    lifecycle.manage(new ManagedGuavaService(this));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:20,代码来源:ScanUploadSchedulingService.java

示例5: ScanUploadMonitor

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
public ScanUploadMonitor(@ScannerZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort,
                         final ScanWorkflow scanWorkflow, final ScanStatusDAO scanStatusDAO,
                         final ScanWriterGenerator scanWriterGenerator,
                         final StashStateListener stashStateListener, final ScanCountListener scanCountListener,
                         final DataTools dataTools, LifeCycleRegistry lifecycle, LeaderServiceTask leaderServiceTask,
                         MetricRegistry metricRegistry) {
    super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES,
            new Supplier<Service>() {
                @Override
                public Service get() {
                    return new LocalScanUploadMonitor(scanWorkflow, scanStatusDAO, scanWriterGenerator,
                            stashStateListener, scanCountListener, dataTools);
                }
            });

    ServiceFailureListener.listenTo(this, metricRegistry);
    leaderServiceTask.register(SERVICE_NAME, this);
    lifecycle.manage(new ManagedGuavaService(this));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:21,代码来源:ScanUploadMonitor.java

示例6: SystemQueueMonitorManager

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
SystemQueueMonitorManager(LifeCycleRegistry lifeCycle,
                          final DatabusEventStore eventStore,
                          final DataCenters dataCenters,
                          @DatabusClusterInfo final Collection<ClusterInfo> clusterInfo,
                          @DatabusZooKeeper CuratorFramework curator,
                          @SelfHostAndPort HostAndPort self,
                          LeaderServiceTask dropwizardTask,
                          final MetricRegistry metricRegistry) {
    LeaderService leaderService = new LeaderService(
            curator, "/leader/queue-monitor", self.toString(), "Leader-QueueMonitor", 1, TimeUnit.MINUTES,
            new Supplier<Service>() {
                @Override
                public Service get() {
                    return new SystemQueueMonitor(eventStore, dataCenters, clusterInfo, metricRegistry);
                }
            });
    ServiceFailureListener.listenTo(leaderService, metricRegistry);
    dropwizardTask.register("queue-monitor", leaderService);
    lifeCycle.manage(new ManagedGuavaService(leaderService));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:22,代码来源:SystemQueueMonitorManager.java

示例7: SingularityLeaderLatch

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
public SingularityLeaderLatch(@Named(SingularityMainModule.HTTP_HOST_AND_PORT) final HostAndPort httpHostAndPort,
    final CuratorFramework curatorFramework, final Set<LeaderLatchListener> listeners) throws Exception {
  super(checkNotNull(curatorFramework, "curatorFramework is null"), LEADER_PATH, httpHostAndPort.toString());

  checkNotNull(listeners, "listeners is null");
  for (LeaderLatchListener listener : listeners) {
    addListener(listener);
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:11,代码来源:SingularityLeaderLatch.java

示例8: PartitionAwareServiceFactory

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
public PartitionAwareServiceFactory(Class<S> serviceClass, MultiThreadedServiceFactory<S> delegate, S local,
                                    HostAndPort self, HealthCheckRegistry healthCheckRegistry,
                                    MetricRegistry metricRegistry) {
    _serviceClass = checkNotNull(serviceClass, "serviceClass");
    _delegate = checkNotNull(delegate, "delegate");
    _local = checkNotNull(local, "local");
    _localId = self.toString();
    _healthCheckRegistry = healthCheckRegistry;
    _errorMeter = metricRegistry.meter(MetricRegistry.name("bv.emodb.web.partition-forwarding",
            serviceClass.getSimpleName(), "errors"));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:12,代码来源:PartitionAwareServiceFactory.java

示例9: MaintenanceSchedulerManager

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
@Inject
public MaintenanceSchedulerManager(LifeCycleRegistry lifeCycle,
                                   final MaintenanceDAO tableDao,
                                   final Optional<Mutex> metadataMutex,
                                   @CurrentDataCenter final String selfDataCenter,
                                   @CachingTableDAORegistry final CacheRegistry cacheRegistry,
                                   @Maintenance final CuratorFramework curator,
                                   @SelfHostAndPort final HostAndPort self,
                                   final LeaderServiceTask dropwizardTask,
                                   final MoveTableTask moveTableTask,
                                   @TableChangesEnabled ValueStore<Boolean> tableChangesEnabled,
                                   @Maintenance final String scope,
                                   final MetricRegistry metricRegistry) {
    final Supplier<Service> maintenanceServiceFactory = new Supplier<Service>() {
        @Override
        public Service get() {
            return new MaintenanceScheduler(tableDao, metadataMutex, selfDataCenter, cacheRegistry, moveTableTask);
        }
    };

    // Now start the maintenance scheduler subject to winning a leader election.
    Supplier<LeaderService> leaderServiceFactory = new Supplier<LeaderService>() {
        @Override
        public LeaderService get() {
            LeaderService service = new LeaderService(
                    curator, "/leader/table-maintenance", self.toString(),
                    "Leader-TableMaintenance-" + scope, 1, TimeUnit.MINUTES,
                    maintenanceServiceFactory);
            ServiceFailureListener.listenTo(service, metricRegistry);
            dropwizardTask.register(scope.toLowerCase() + "-maintenance", service);
            return service;
        }
    };

    // Turn everything on and off based on a boolean flag in ZooKeeper.
    lifeCycle.manage(new GuavaServiceController(tableChangesEnabled, leaderServiceFactory));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:38,代码来源:MaintenanceSchedulerManager.java

示例10: getLeaderServices

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
public List<LeaderService> getLeaderServices(final Map<String, ValueStore<Long>> timestampCache,
                                             CuratorFramework curator,
                                             HostAndPort self,
                                             final Map<String, HintsPollerCQLSession> cqlSessionForHintsPollerMap,
                                             final ClusterHintsPoller clusterHintsPoller,
                                             LeaderServiceTask dropwizardTask,
                                             final MetricRegistry metricRegistry) {
    _leaderServiceList = Lists.newArrayList();
    String serverId = self.toString(); // For debugging

    // Start one hints poller for each data store cluster
    for (final Map.Entry<String, HintsPollerCQLSession> entry : cqlSessionForHintsPollerMap.entrySet()) {
        final String clusterName = entry.getKey();
        final Session session = entry.getValue().getCqlSession();
        String zkLeaderPath = "/leader/hints/" + clusterName;
        String threadName = "Leader-HintsPoller-" + clusterName;
        LeaderService leaderService = new LeaderService(
                curator, zkLeaderPath, serverId, threadName, 1, TimeUnit.MINUTES,
                new Supplier<Service>() {
                    @Override
                    public Service get() {
                        return new HintsPollerService(clusterName, timestampCache.get(clusterName), session, clusterHintsPoller, metricRegistry);
                    }
                });
        ServiceFailureListener.listenTo(leaderService, metricRegistry);
        dropwizardTask.register("hints-" + clusterName, leaderService);
        _leaderServiceList.add(leaderService);
    }

    return _leaderServiceList;
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:32,代码来源:HintsPollerManager.java

示例11: serialize

import com.google.common.net.HostAndPort; //导入方法依赖的package包/类
public JsonElement serialize(HostAndPort hostAndPort, Type typeOfSchema,
                             JsonSerializationContext context) {
    return new JsonPrimitive(hostAndPort.toString());
}
 
开发者ID:vmware,项目名称:hillview,代码行数:5,代码来源:ClusterDescription.java


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