创建一个新的redis实现的分布式管理器

@param host     redis的主机地址，例如192.168.1.100
@param port     redis的端口，例如8080
@param password 密码
@return redis实现的分布式锁管理器
557538
public static RedisClusterManager newInstance(String host, int port, String password) {
        return newInstance(buildRedisConfig(host, port, password));
    }
1033734
public function create($host = '', $port = '')
    {
        $this->host = ($host != '') ? $host : 'localhost';
        $this->port = ($port != '') ? $port : 11211;

        if (is_null($this->memory)) {
            $this->memory = new \Memcache();
            $this->isEnabled = true;

            if (!$this->memory->connect($this->host, $this->port)) { // Instead 'localhost' here can be IP
                $this->memory = null;
                $this->isEnabled = true;
            }
        }

        return $this;
    }
116847
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password) {
        return newJedisPool(hostsAndPorts, password, DEFAULT_TIMEOUT_MS);
    }
33272
public static function create($host, $port, $password)
    {
        $factory = new \Socket\Raw\Factory();
        $socket = $factory->createClient(sprintf('%s:%s', $host, $port));

        return new \gries\Rcon\Connection($socket, $password);
    }
428457
public static QConnectorSync create(final String host, final int port) {
		return create(host, port, true, true);
	}
1199487
public static ShardedJedisPool newShardedJedisPool(String hostsAndPorts, String password) {
        return newShardedJedisPool(defaultJedisPoolConfig(), hostsAndPorts, password);
    }
30795
public function connect($host = null, $port = null)
    {
        $this->_host = null !== $host ? $host : $this->_host;
        $this->_port = null !== $port ? $port : $this->_port;
        if (false === $this->_ssh_resource = ssh2_connect($this->_host, $this->_port)) {
            throw new TransportException(sprintf('Enable to connect to %s:%i.', $this->_host, $this->_port));
        }

        return $this;
    }
771620
public static NetworkPort remotePort(String hostname, int port){
        return new RemoteNetworkPort(hostname, port, NetworkPort.Type.TCP);
    }
612230
public static String toSocketAddressString(String host, int port) {
        String portStr = String.valueOf(port);
        return newSocketAddressStringBuilder(
                host, portStr, !isValidIpV6Address(host)).append(':').append(portStr).toString();
    }
621886
public static String authorityFromHostAndPort(String host, int port) {
    try {
      return new URI(null, null, host, port, null, null, null).getAuthority();
    } catch (URISyntaxException ex) {
      throw new IllegalArgumentException("Invalid host or port: " + host + " " + port, ex);
    }
  }
375048
public static Proxy httpProxy(String host, int port) {
        return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Objects.requireNonNull(host), port));
    }
361770
def create_redis_client(redis_address, password=None):
    
    redis_ip_address, redis_port = redis_address.split(":")
    # For this command to work, some other client (on the same machine
    # as Redis) must have run "CONFIG SET protected-mode no".
    return redis.StrictRedis(
        host=redis_ip_address, port=int(redis_port), password=password)
1324202
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password,
            long timeoutMs) {
        final int maxTotal = Runtime.getRuntime().availableProcessors();
        final int maxIdle = maxTotal / 2;

        JedisPoolConfig poolConfig = new JedisPoolConfig();
        poolConfig.setMaxTotal(maxTotal);
        poolConfig.setMinIdle(1);
        poolConfig.setMaxIdle(maxIdle > 0 ? maxIdle : 1);
        poolConfig.setMaxWaitMillis(timeoutMs);
        // poolConfig.setTestOnBorrow(true);
        poolConfig.setTestWhileIdle(true);

        List<JedisShardInfo> shards = new ArrayList<>();
        String[] hapList = hostsAndPorts.split("[,;\\s]+");
        for (String hostAndPort : hapList) {
            String[] tokens = hostAndPort.split(":");
            String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST;
            int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT;
            JedisShardInfo shardInfo = new JedisShardInfo(host, port);
            shardInfo.setPassword(password);
            shards.add(shardInfo);
        }
        ShardedJedisPool jedisPool = new ShardedJedisPool(poolConfig, shards);

        return jedisPool;
    }
476425
public static HttpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
        return newClient(new InetSocketAddress(host, port));
    }
1369956
function createClient(port, host, password) {
	var client = redis.createClient(port, host, {
		connect_timeout: false, // Never stop trying to connect to Redis...
		max_attempts: null, // ... no matter how many times it slaps us in the face.
		retry_max_delay: 5000, // Decay attempts to reconnect to a max of 5 seconds.
		enable_offline_queue: true // Queue up requests while we wait for a connection to re-establish.
	});

	client.on('error', function(err) {
		// Log the error, but don't quit. Our offline queue will keep us going until Redis comes back.
		log.error(err);
	});

	if (client && password) {
		client.auth(password);
	}

	return client;
}
1200905
public void connect(String hostName, int port) throws UnknownHostException, IOException {
        if (!sslHelper.isSocketAvailable()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                Tr.event(tc, "creating/recreating socket connection to " + hostName + ":" + port);

            SSLSocket socket = sslHelper.createSocket(hostName, port);
            in = new BufferedInputStream(socket.getInputStream());
            out = new BufferedOutputStream(socket.getOutputStream());

            // seqNumber must only be reset to 1 when connection is initialized (as in this case)
            seqNumber = 1;

            // new connection - reset lastUsedTime
            lastUsedTime = System.currentTimeMillis();
        }
    }
333090
public static ServerSocketBar createJNI(InetAddress host, int port)
    throws IOException
  {
      return currentFactory().create(host, port, 0, true);
  }