Creates a new {@link JedisClientPool}.

@param host
@param port
@param username
@param password
@return
348159
protected JedisClientPool createRedisClientPool(String host, int port, String username,
            String password) {
        return createRedisClientPool(host, port, username, password, null);
    }
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;
        }
    }
1250322
public static RedisURI create(String host, int port) {
        return Builder.redis(host, port).build();
    }
239636
public static IJedisPool createJedisPool(String server, int timeout) {
		int maxActive = 32;
		return createJedisPool(server, timeout, maxActive, null);
	}
101103
public SdkClientBuilder defaultProxy(String hostname, int port, final String scheme)
    {
        this.defaultProxy = new HttpHost(hostname, port, scheme);
        return this;
    }
1036088
@Override
	public QueueConnection createQueueConnection(String userName, String password) throws JMSException
    {
        URI providerURL = getProviderURI();
        
        String scheme = providerURL.getScheme();
        if (scheme.equals(PacketTransportType.VM))
        {
            String engineName = providerURL.getHost();
            return FFMQEngine.getDeployedInstance(engineName).openQueueConnection(userName, password, clientID);
        }
        else 
        if (scheme.equals(PacketTransportType.TCP) ||
            scheme.equals(PacketTransportType.TCPS) ||
            scheme.equals(PacketTransportType.TCPNIO))
        {
            return new RemoteQueueConnection(providerURL, userName, password, clientID);
        }
        else
            throw new FFMQException("Unknown transport protocol : " + scheme,"INVALID_TRANSPORT_PROTOCOL");
    }
465704
def create_jdbc_resource(name, server=None, **kwargs):
    '''
    
    '''
    defaults = {
        'description': '',
        'enabled': True,
        'id': name,
        'poolName': '',
        'target': 'server'
    }

    # Data = defaults + merge kwargs + poolname
    data = defaults
    data.update(kwargs)

    if not data['poolName']:
        raise CommandExecutionError('No pool name!')

    return _create_element(name, 'resources/jdbc-resource', data, server)
386501
public HttpClient createClient(int maxConnPerRoute, int connTimeoutMillis, int soTimeoutMillis, @Nullable String proxyHostAnPort) {
		Registry<ConnectionSocketFactory> defaultRegistry = RegistryBuilder
			.<ConnectionSocketFactory> create()
			.register("http", PlainConnectionSocketFactory.getSocketFactory())
			.register("https", SSLConnectionSocketFactory.getSocketFactory())
			.build();
		PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(defaultRegistry);
			connMgr.setDefaultMaxPerRoute(maxConnPerRoute);
		RequestConfig rCfg = RequestConfig.custom()
			.setConnectTimeout(connTimeoutMillis)
			.setSocketTimeout(soTimeoutMillis)
			.build();
		HttpClientBuilder hcb = HttpClientBuilder.create()
			.setConnectionManager(connMgr)
			.setDefaultRequestConfig(rCfg);
		if (proxyHostAnPort == null) {
			// do something?
		} else if("jvm".equalsIgnoreCase(proxyHostAnPort)) {
			SystemDefaultRoutePlanner rp = new SystemDefaultRoutePlanner(ProxySelector.getDefault());
			hcb.setRoutePlanner(rp);
		} else {
			String[] hostAndPort = proxyHostAnPort.split(":");
			Check.illegalargument.assertTrue(hostAndPort.length < 3, "wrong hostAndPort:"+proxyHostAnPort);
			String host = hostAndPort[0];
			int port = 80;
			if (hostAndPort.length > 1) {
				port = Integer.valueOf(hostAndPort[1]);
			}
			HttpHost proxy = new HttpHost(host, port);
			hcb.setProxy(proxy);
		}
		HttpClient httpClient = hcb.build();
		return httpClient;
	}
307341
public static JedisCluster newJedisCluster(JedisPoolConfig poolConfig, String hostsAndPorts,
            String password, int timeoutMs) {
        return newJedisCluster(poolConfig, hostsAndPorts, password, timeoutMs, 3);
    }
1199487
public static ShardedJedisPool newShardedJedisPool(String hostsAndPorts, String password) {
        return newShardedJedisPool(defaultJedisPoolConfig(), hostsAndPorts, password);
    }
799263
protected static String calcRedisPoolName(String host, int port, String username,
            String password, PoolConfig poolConfig) {
        StringBuilder sb = new StringBuilder();
        sb.append(host != null ? host : "NULL");
        sb.append(".");
        sb.append(port);
        sb.append(".");
        sb.append(username != null ? username : "NULL");
        sb.append(".");
        int passwordHashcode = password != null ? password.hashCode() : "NULL".hashCode();
        int poolHashcode = poolConfig != null ? poolConfig.hashCode() : "NULL".hashCode();
        return sb.append(passwordHashcode).append(".").append(poolHashcode).toString();
    }
972434
public DataSiftConfig proxy(String host, int port, String username, String password) {
        http.proxy(host, port, username, password);
        return this;
    }
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;
    }
1223529
public void removeConnectionPool(String host, int port) {
        RequestBuilder req = new RequestBuilder();
        req.host = host;
        req.port = port;
        removePool(req);
    }
785230
public Ftp init(String host, int port, String user, String password) {
		return this.init(host,port,user,password,null);
	}
23148
public PooledConnection getPooledConnection(String user, String password) throws SQLException {
    return new PGPooledConnection(getConnection(user, password), defaultAutoCommit);
  }
1081143
@Override
	public final Connection createConnection(String userName, String password) throws JMSException
    {
        URI providerURL = getProviderURI();
        
        String scheme = providerURL.getScheme();
        if (scheme.equals(PacketTransportType.VM))
        {
            String engineName = providerURL.getHost();
            return FFMQEngine.getDeployedInstance(engineName).openConnection(userName, password, clientID);
        }
        else 
        if (scheme.equals(PacketTransportType.TCP) ||
            scheme.equals(PacketTransportType.TCPS) ||
            scheme.equals(PacketTransportType.TCPNIO))
        {
            return new RemoteConnection(providerURL, userName, password, clientID);
        }
        else
            throw new FFMQException("Unknown transport protocol : " + scheme,"INVALID_TRANSPORT_PROTOCOL");
    }