Create a new {@link JedisPool} with default pool configs.

@param hostAndPort
format {@code host:port} or {@code host}, default Redis port is used if not
specified
@param password
@return
436751
public static JedisPool newJedisPool(String hostAndPort, String password) {
        return newJedisPool(defaultJedisPoolConfig(), hostAndPort, password);
    }
896879
public static Endpoint of(String host, int port) {
        validatePort("port", port);
        return create(host, port);
    }
598609
public void changeNFSUserPassword(String password) throws HostConfigFault, NotFound, RuntimeFault, RemoteException {
        getVimService().changeNFSUserPassword(getMOR(), password);
    }
81695
public static HostAndPort hostAndPort(AbstractConfig config, String key) {
    return hostAndPort(config, key, null);
  }
16263
public static HostAndPort fromString(String hostPort, int defaultPort) {
    if (hostPort == null) throw new NullPointerException("hostPort == null");

    String host = hostPort;
    int endHostIndex = hostPort.length();
    if (hostPort.startsWith("[")) { // Bracketed IPv6
      endHostIndex = hostPort.lastIndexOf(']') + 1;
      host = hostPort.substring(1, endHostIndex == 0 ? 1 : endHostIndex - 1);
      if (!Endpoint.newBuilder().parseIp(host)) { // reuse our IPv6 validator
        throw new IllegalArgumentException(hostPort + " contains an invalid IPv6 literal");
      }
    } else {
      int colonIndex = hostPort.indexOf(':'), nextColonIndex = hostPort.lastIndexOf(':');
      if (colonIndex >= 0) {
        if (colonIndex == nextColonIndex) { // only 1 colon
          host = hostPort.substring(0, colonIndex);
          endHostIndex = colonIndex;
        } else if (!Endpoint.newBuilder().parseIp(hostPort)) { // reuse our IPv6 validator
          throw new IllegalArgumentException(hostPort + " is an invalid IPv6 literal");
        }
      }
    }
    if (host.isEmpty()) throw new IllegalArgumentException(hostPort + " has an empty host");
    if (endHostIndex + 1 < hostPort.length() && hostPort.charAt(endHostIndex) == ':') {
      return new HostAndPort(host, validatePort(hostPort.substring(endHostIndex + 1), hostPort));
    }
    return new HostAndPort(host, defaultPort);
  }
983637
public void configureNetty(String host, int port){
        Map<String, Object> params = map(TransportConstants.HOST_PROP_NAME, host, TransportConstants.PORT_PROP_NAME, port);
        config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), params));
    }
87208
public static IPool getPool(String host, Integer port, String database, String... userPwd) {
        //暂未启用
        throw new RuntimeException("未找到指定的数据库连接池");
    }
424268
public static void useResource(String host, int port, String user, String password, Authentication authType)
    throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
  {
    // create the client
    DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);

    // create the resource extension client
    HelloWorld hello = new HelloWorld(client);

    String response = hello.sayHello();
    System.out.println("Called hello worlds service, got response:["+ response + "]");

    // release the client
    client.release();
  }
881707
public static JMXConnector connect(final String hostportOrPid, final String login, final String password)
			throws IOException {
		// ./vjmxcli.sh - 127.0.0.1:8060 gcutil
		if (hostportOrPid.contains(":")) {
			JMXServiceURL rmiurl = new JMXServiceURL(
					"service:jmx:rmi://" + hostportOrPid + "/jndi/rmi://" + hostportOrPid + "/jmxrmi");
			return JMXConnectorFactory.connect(rmiurl, formatCredentials(login, password));
		} else {
			// ./vjmxcli.sh - 112222 gcutil
			String localAddress = getLocalConnectorAddress(hostportOrPid);
			JMXServiceURL localRmiurl = new JMXServiceURL(localAddress);
			return JMXConnectorFactory.connect(localRmiurl);
		}
	}
178269
public IRedisClient getRedisClient(final String host, final int port, final String username,
            final String password, final PoolConfig poolConfig) {
        String poolName = calcRedisPoolName(host, port, username, password, poolConfig);

        try {
            JedisClientPool redisClientPool = cacheRedisClientPools.get(poolName,
                    new Callable<JedisClientPool>() {
                        @Override
                        public JedisClientPool call() throws Exception {
                            return createRedisClientPool(host, port, username, password, poolConfig);
                        }
                    });
            return redisClientPool.borrowObject();
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            return null;
        }
    }
918095
public String formatKey(String host, int port) throws URISyntaxException
	{
		if (port < 1) {
			throw new URISyntaxException("","The port value must be greater than zero");
		}
		
		if (!"".equals(host)) {
			return host + ":" + port;
		} else {
			throw new URISyntaxException("","The host cannot be null");
		}
	}
373538
public static JedisPool newJedisPool(JedisPoolConfig poolConfig, String hostAndPort) {
        return newJedisPool(poolConfig, hostAndPort, null, Protocol.DEFAULT_DATABASE,
                Protocol.DEFAULT_TIMEOUT);
    }
754248
public static InetSocketAddress createAddress(String host, int port) {
		if (StrUtil.isBlank(host)) {
			return new InetSocketAddress(port);
		}
		return new InetSocketAddress(host, port);
	}
1199487
public static ShardedJedisPool newShardedJedisPool(String hostsAndPorts, String password) {
        return newShardedJedisPool(defaultJedisPoolConfig(), hostsAndPorts, password);
    }
1295018
protected Socket createSocket(String host, int port) throws SocketException, UnknownHostException
    {
        Socket socket = null;
        int retries = 0;

        // Loop to get a connection or until we've exhausted number of retries
        Throwable cause = null;
        while (retries < CONTEXT.getConfig().getSocketRetries()) {
            try {
            	
            	socket = createSocketFromFactory(SocketFactory.getDefault(), host, port);
            	
                break;
            } catch (UnknownHostException e) {
            	logger.error("Unknown host. Unable to establish connection to " + host + " on port "+ port +". Reason: "+e.getLocalizedMessage(),e);
            	throw e;
            } catch (SocketException e) {
                // Some kind of error, retry if we haven't exceeded max retry
                // count
            	logger.error("Error connecting to " + host + " on port "+ port +". Will retry in " + CONTEXT.getConfig().getSocketRetryWait() / 1000 + " seconds. "
            			       + (CONTEXT.getConfig().getSocketRetries() - retries) +" retries left. Cause: "+e.getLocalizedMessage(),e);

            	cause = e;
            	retries++;
            	
                try {
                    Thread.sleep(CONTEXT.getConfig().getSocketRetryWait());
                    continue;
                } catch (InterruptedException ie) {
                	if(logger.isDebugEnabled()){
                		logger.debug("Sleep awoken early");
                	}
                    continue;
                }

            } catch (IOException e) {
                // Some kind of error, retry if we haven't exceeded max retry
                // count
            	logger.error("Error connecting to " + host + " on port "+ port +". Will retry in "
                        + CONTEXT.getConfig().getSocketRetryWait() / 1000 + " seconds. "
     			       + (CONTEXT.getConfig().getSocketRetries() - retries) +" retries left. Cause: "+e.getLocalizedMessage(),e);

                retries++;
                cause = e;
                continue;
            }
        }

        if (retries >= CONTEXT.getConfig().getSocketRetries()) {
			logger.error("Socket Connect Retries Exhausted.", cause);
           	throw new ConnectException("Socket Connect Retries Exhausted. "+ (cause != null ? "Cause was: "+cause.getLocalizedMessage():""));
        }

        return socket;
    }
915642
Jedis getConnection()
    {
        if (logger.isDebugEnabled())
            logger.info("borrowing connection from pool");
        Object poolOrConnection = getConnectionPoolOrConnection();
        if (poolOrConnection != null && poolOrConnection instanceof JedisPool)
        {

            Jedis connection = ((JedisPool) getConnectionPoolOrConnection()).getResource();
            connection.getClient().setTimeoutInfinite();
            Map props = RedisPropertyReader.rsmd.getProperties();

            // set external xml properties.
            if (props != null)
            {
                // props.
                for (Object key : props.keySet())
                {
                    connection.configSet(key.toString(), props.get(key).toString());
                }
            }
            return connection;
            
        }
        else
        {
            PersistenceUnitMetadata puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(
                    getPersistenceUnit());

            Properties props = puMetadata.getProperties();
            String contactNode = null;
            String defaultPort = null;
            String password = null;
            if (externalProperties != null)
            {
                contactNode = (String) externalProperties.get(PersistenceProperties.KUNDERA_NODES);
                defaultPort = (String) externalProperties.get(PersistenceProperties.KUNDERA_PORT);
                password = (String) externalProperties.get(PersistenceProperties.KUNDERA_PASSWORD);
            }

            if (contactNode == null)
            {
                contactNode = RedisPropertyReader.rsmd.getHost() != null ? RedisPropertyReader.rsmd.getHost()
                        : (String) props.get(PersistenceProperties.KUNDERA_NODES);
            }
            if (defaultPort == null)
            {
                defaultPort = RedisPropertyReader.rsmd.getPort() != null ? RedisPropertyReader.rsmd.getPort()
                        : (String) props.get(PersistenceProperties.KUNDERA_PORT);
            }
            if (password == null)
            {
                password = RedisPropertyReader.rsmd.getPassword() != null ? RedisPropertyReader.rsmd.getPassword()
                        : (String) props.get(PersistenceProperties.KUNDERA_PASSWORD);
            }
            if (defaultPort == null || !StringUtils.isNumeric(defaultPort))
            {
                throw new RuntimeException("Invalid port provided: " + defaultPort);
            }
            Jedis connection = new Jedis(contactNode, Integer.parseInt(defaultPort));

            if (password != null)
            {
                connection.auth(password);
            }
            connection.connect();
            return connection;
        }
    }
62636
@Override
    protected JedisConnector buildJedisConnector() {
        JedisConnector jedisConnector = new JedisConnector();
        jedisConnector.setJedisPoolConfig(JedisUtils.defaultJedisPoolConfig())
                .setRedisHostsAndPorts(redisHostAndPort).init();
        return jedisConnector;
    }