當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。