Package com.google.common.net

Examples of com.google.common.net.HostAndPort


          } catch (IOException ex) {
            log.error("Unable to delete wal " + path + ": " + ex);
          }
        }
      } else {
        HostAndPort address = AddressUtil.parseAddress(entry.getKey(), false);
        if (!holdsLock(address)) {
          for (Path path : entry.getValue()) {
            log.debug("Removing WAL for offline server " + path);
            try {
              if (!useTrash || !fs.moveToTrash(path))
View Full Code Here


    TransactionWatcher watcher = new TransactionWatcher();
    ThriftClientHandler tch = new ThriftClientHandler(HdfsZooInstance.getInstance(), watcher);
    Processor<Iface> processor = new Processor<Iface>(tch);
    TServerUtils.startTServer(HostAndPort.fromParts("0.0.0.0", opts.port), processor, "NullTServer", "null tserver", 2, 1000, 10 * 1024 * 1024, null, -1);
   
    HostAndPort addr = HostAndPort.fromParts(InetAddress.getLocalHost().getHostName(), opts.port);
   
    // modify metadata
    ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance(opts.iname).withZkHosts(opts.keepers));
    String tableId = Tables.getTableId(zki, opts.tableName);
   
View Full Code Here

      FileStatus fileStatus = ns.getFileStatus(filePath);
      BlockLocation[] fileBlockLocations = ns.getFileBlockLocations(fileStatus, 0, fileStatus.getLen());
      for (BlockLocation blockLocation : fileBlockLocations) {
        allBlocks++;
        for (String location : blockLocation.getHosts()) {
          HostAndPort hap = HostAndPort.fromParts(location, 0);
          if (hap.getHostText().equals(host)) {
            matchingBlocks++;
            break;
          }
        }
      }
View Full Code Here

      currentUrl = this.publicAddress;
    } else {
      String scheme;
      String host;
      int port;
      HostAndPort forwardedHostData = getForwardedHostData(context);
      if (forwardedHostData != null) {
        scheme = determineScheme(context, this.scheme);
        host = forwardedHostData.getHostText();
        port = forwardedHostData.getPortOrDefault(-1);
      } else {
        URI absoluteRequestURI = getAbsoluteRequestUri(context);
        if (absoluteRequestURI != null) {
          scheme = determineScheme(context, absoluteRequestURI.getScheme());
          host = absoluteRequestURI.getHost();
          port = absoluteRequestURI.getPort();
        } else {
          scheme = determineScheme(context, this.scheme);
          HostAndPort hostData = getHostData(context);
          if (hostData != null) {
            host = hostData.getHostText();
            port = hostData.getPortOrDefault(-1);
          } else {
            BindAddress bindAddress = context.getBindAddress();
            int bindPort = bindAddress.getPort();
            host = bindAddress.getHost();
            port = ProtocolUtil.isDefaultPortForScheme(bindPort, this.scheme) ? -1 : bindPort;
View Full Code Here

        RedisChannelWriter<K, V> channelWriter = null;

        if (commandToSend instanceof ClusterCommand) {
            ClusterCommand<K, V, T> clusterCommand = (ClusterCommand<K, V, T>) commandToSend;
            if (!clusterCommand.isDone() && clusterCommand.isMoved()) {
                HostAndPort moveTarget = getMoveTarget(clusterCommand.getError());

                RedisAsyncConnectionImpl<K, V> connection = clusterConnectionProvider.getConnection(
                        ClusterConnectionProvider.Intent.WRITE, moveTarget.getHostText(), moveTarget.getPort());
                channelWriter = connection.getChannelWriter();
            }

        }
View Full Code Here

        Iterator<String> iterator = split.iterator();

        RedisClusterNode partition = new RedisClusterNode();
        partition.setNodeId(iterator.next());

        HostAndPort hostAndPort = HostAndPort.fromString(iterator.next());

        if (LettuceStrings.isNotEmpty(hostAndPort.getHostText())) {
            partition.setUri(RedisURI.Builder.redis(hostAndPort.getHostText(), hostAndPort.getPort()).build());
        }

        String flags = iterator.next();
        List<String> flagStrings = Lists.newArrayList(Splitter.on(',').trimResults().split(flags).iterator());
View Full Code Here

                }

                if (builder == null && LettuceStrings.isNotEmpty(uri.getAuthority())) {
                    String[] hosts = uri.getAuthority().split("\\,");
                    for (String host : hosts) {
                        HostAndPort hostAndPort = HostAndPort.fromString(host);
                        if (builder == null) {
                            if (hostAndPort.hasPort()) {
                                builder = RedisURI.Builder.sentinel(hostAndPort.getHostText(), hostAndPort.getPort(), masterId);
                            } else {
                                builder = RedisURI.Builder.sentinel(hostAndPort.getHostText(), masterId);
                            }
                        } else {
                            if (hostAndPort.hasPort()) {
                                builder.withSentinel(hostAndPort.getHostText(), hostAndPort.getPort());
                            } else {
                                builder.withSentinel(hostAndPort.getHostText());
                            }
                        }
                    }

                }
View Full Code Here

    double currentMajorAvg = 0;
    double currentMinorStdDev = 0;
    double currentMajorStdDev = 0;
    TabletStats total = new TabletStats(null, new ActionStats(), new ActionStats(), new ActionStats(), 0, 0, 0, 0);
   
    HostAndPort address = HostAndPort.fromString(tserverAddress);
    TabletStats historical = new TabletStats(null, new ActionStats(), new ActionStats(), new ActionStats(), 0, 0, 0, 0);
    List<TabletStats> tsStats = new ArrayList<TabletStats>();
    try {
      TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, Monitor.getSystemConfiguration());
      try {
View Full Code Here

        if (portHint != 0 && i > 0)
          port = 1024 + random.nextInt(65535 - 1024);
        if (port > 65535)
          port = 1024 + port % (65535 - 1024);
        try {
          HostAndPort addr = HostAndPort.fromParts(address, port);
          return TServerUtils.startTServer(addr, timedProcessor, serverName, threadName, minThreads, timeBetweenThreadChecks, maxMessageSize,
              SslConnectionParams.forServer(conf), conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT));
        } catch (TTransportException ex) {
          log.error("Unable to start TServer", ex);
          if (ex.getCause() == null || ex.getCause().getClass() == BindException.class) {
View Full Code Here

            case "discovery":
                return injector.getInstance(DiscoveryLocatedHiveCluster.class);
            case "thrift":
                checkArgument(uri.getHost() != null, "metastoreUri host is missing: %s", uri);
                checkArgument(uri.getPort() != -1, "metastoreUri port is missing: %s", uri);
                HostAndPort address = HostAndPort.fromParts(uri.getHost(), uri.getPort());
                return new StaticHiveCluster(address, injector.getInstance(HiveMetastoreClientFactory.class));
        }
        throw new IllegalArgumentException("unsupported metastoreUri: " + uri);
    }
View Full Code Here

TOP

Related Classes of com.google.common.net.HostAndPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.