@Override public UnixSocket createSocket(final HttpContext context) throws IOException { return UnixSocketChannel.open().socket(); }
@Override public UnixSocket createSocket(final HttpContext context) throws IOException { return UnixSocketChannel.open().socket(); }
@Override public Socket createSocket(final HttpContext context) throws IOException { return UnixSocketChannel.open().socket(); }
@Override public Socket createSocket() throws IOException { // Custom env variable for forcing unix socket boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info( String.format("Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress(new File(CLOUD_SQL_PREFIX + instanceName + POSTGRES_SUFFIX)); return UnixSocketChannel.open(socketAddress).socket(); } // Default to SSL Socket logger.info( String.format("Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); return SslSocketFactory.getInstance().create(instanceName, ipTypes); }
@Override public Socket createSocket() throws IOException { // Custom env variable for forcing unix socket boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info( String.format("Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress(new File(CLOUD_SQL_PREFIX + instanceName + POSTGRES_SUFFIX)); return UnixSocketChannel.open(socketAddress).socket(); } // Default to SSL Socket logger.info( String.format("Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); return SslSocketFactory.getInstance().create(instanceName, ipTypes); }
@Override public Socket connect(String hostname, int portNumber, Properties props) throws IOException { String instanceName = props.getProperty("cloudSqlInstance"); checkArgument( instanceName != null, "cloudSqlInstance property not set. Please specify this property in the JDBC URL or " + "the connection Properties with value in form \"project:region:instance\""); // Custom env variable for forcing unix socket Boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info( String.format("Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress(new File(CloudSqlPrefix + instanceName)); this.socket = UnixSocketChannel.open(socketAddress).socket(); } else { // Default to SSL Socket logger.info( String.format("Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); List<String> ipTypes = SslSocketFactory.listIpTypes( props.getProperty("ipTypes", SslSocketFactory.DEFAULT_IP_TYPES)); this.socket = SslSocketFactory.getInstance().create(instanceName, ipTypes); } return this.socket; }
public <T extends Closeable> T connect(String host, int portNumber, Properties props, int loginTimeout) throws IOException { String instanceName = props.getProperty("cloudSqlInstance"); checkArgument( instanceName != null, "cloudSqlInstance property not set. Please specify this property in the JDBC URL or " + "the connection Properties with value in form \"project:region:instance\""); // Custom env variable for forcing unix socket boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info(String.format( "Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress( new File(CloudSqlPrefix + instanceName)); this.socket = UnixSocketChannel.open(socketAddress).socket(); } else { // Default to SSL Socket logger.info(String.format( "Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); List<String> ipTypes = SslSocketFactory.listIpTypes( props.getProperty("ipTypes", SslSocketFactory.DEFAULT_IP_TYPES)); this.socket = SslSocketFactory.getInstance().create(instanceName, ipTypes); } @SuppressWarnings("unchecked") T castSocket = (T) this.socket; return castSocket; }
@Override public Socket connect(String host, int portNumber, Properties props, int loginTimeout) throws IOException { String instanceName = props.getProperty("cloudSqlInstance"); checkArgument( instanceName != null, "cloudSqlInstance property not set. Please specify this property in the JDBC URL or " + "the connection Properties with value in form \"project:region:instance\""); // Custom env variable for forcing unix socket boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info( String.format("Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress(new File(CloudSqlPrefix + instanceName)); this.socket = UnixSocketChannel.open(socketAddress).socket(); } else { // Default to SSL Socket logger.info( String.format("Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); List<String> ipTypes = SslSocketFactory.listIpTypes( props.getProperty("ipTypes", SslSocketFactory.DEFAULT_IP_TYPES)); this.socket = SslSocketFactory.getInstance().create(instanceName, ipTypes); } return this.socket; }
public <T extends Closeable> T connect(String host, int portNumber, Properties props, int loginTimeout) throws IOException { String instanceName = props.getProperty("cloudSqlInstance"); checkArgument( instanceName != null, "cloudSqlInstance property not set. Please specify this property in the JDBC URL or " + "the connection Properties with value in form \"project:region:instance\""); // Custom env variable for forcing unix socket boolean forceUnixSocket = System.getenv("CLOUD_SQL_FORCE_UNIX_SOCKET") != null; // If running on GAE Standard, connect with unix socket if (forceUnixSocket || runningOnGaeStandard()) { logger.info(String.format( "Connecting to Cloud SQL instance [%s] via unix socket.", instanceName)); UnixSocketAddress socketAddress = new UnixSocketAddress( new File(CloudSqlPrefix + instanceName)); this.socket = UnixSocketChannel.open(socketAddress).socket(); } else { // Default to SSL Socket logger.info(String.format( "Connecting to Cloud SQL instance [%s] via ssl socket.", instanceName)); List<String> ipTypes = SslSocketFactory.listIpTypes( props.getProperty("ipTypes", SslSocketFactory.DEFAULT_IP_TYPES)); this.socket = SslSocketFactory.getInstance().create(instanceName, ipTypes); } @SuppressWarnings("unchecked") T castSocket = (T) this.socket; return castSocket; }