? socketfactory.patch Index: org/postgresql/core/PGStream.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/PGStream.java,v retrieving revision 1.22.4.1 diff -r1.22.4.1 PGStream.java 18a19 > import java.lang.reflect.Constructor; 19a21 > import java.net.SocketException; 20a23,25 > import java.util.Properties; > > import javax.net.SocketFactory; 36a42 > private final SocketFactory socketFactory; 54a61 > * @param socketFactory {@link SocketFactory} used for creating the sockets 57c64 < public PGStream(String host, int port) throws IOException --- > public PGStream(String host, int port, SocketFactory socketFactory) throws IOException 61,62c68,73 < < changeSocket(new Socket(host, port)); --- > > if (socketFactory == null) { > socketFactory = SocketFactory.getDefault(); > } > this.socketFactory = socketFactory; > changeSocket(this.socketFactory.createSocket(host, port)); 67a79,135 > > /** > * Constructor: Connect to the PostgreSQL back end and return > * a stream connection. > * > * @param host the hostname to connect to > * @param port the port number that the postmaster is sitting on > * @param info properties used to create the socket factory > * @exception IOException if an IOException occurs below it. > */ > public PGStream(String host, int port, Properties info) throws IOException > { > this(host, port, createSocketFactory(info)); > } > > public static SocketFactory createSocketFactory(Properties info) { > SocketFactory factory; > > // Use the default factory if no specific factory is requested > // > String classname = info.getProperty("socketfactory"); > if (classname == null) > { > factory = SocketFactory.getDefault(); > } > else > { > Object[] args = {info.getProperty("socketfactoryarg")}; > Constructor ctor; > Class factoryClass; > > try > { > factoryClass = Class.forName(classname); > try > { > ctor = factoryClass.getConstructor(new Class[]{String.class}); > } > catch (NoSuchMethodException nsme) > { > ctor = factoryClass.getConstructor((Class[])null); > args = null; > } > factory = (SocketFactory)ctor.newInstance(args); > } > catch (Exception e) > { > throw new RuntimeException(new PSQLException(GT.tr("The SocketFactory class provided {0} could not be instantiated.", classname), PSQLState.CONNECTION_FAILURE, e)); > } > } > > return factory; > } > > public SocketFactory getSocketFactory() throws PSQLException { > return socketFactory; > } 108c176,180 < connection.setTcpNoDelay(true); --- > try { > connection.setTcpNoDelay(true); > } catch (SocketException e) { > // Ignore if the operation wasn't supported. > } Index: org/postgresql/core/v2/ConnectionFactoryImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v2/ConnectionFactoryImpl.java,v retrieving revision 1.18.2.1 diff -r1.18.2.1 ConnectionFactoryImpl.java 62c62 < newStream = new PGStream(host, port); --- > newStream = new PGStream(host, port, info); 163c163 < return new PGStream(pgStream.getHost(), pgStream.getPort()); --- > return new PGStream(pgStream.getHost(), pgStream.getPort(), pgStream.getSocketFactory()); Index: org/postgresql/core/v2/ProtocolConnectionImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v2/ProtocolConnectionImpl.java,v retrieving revision 1.12 diff -r1.12 ProtocolConnectionImpl.java 93c93 < cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort()); --- > cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort(), pgStream.getSocketFactory()); Index: org/postgresql/core/v3/ConnectionFactoryImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v3/ConnectionFactoryImpl.java,v retrieving revision 1.20.2.1 diff -r1.20.2.1 ConnectionFactoryImpl.java 16a17 > import java.lang.reflect.Constructor; 76c77,78 < newStream = new PGStream(host, port); --- > > newStream = new PGStream(host, port, info); 192c194 < return new PGStream(pgStream.getHost(), pgStream.getPort()); --- > return new PGStream(pgStream.getHost(), pgStream.getPort(), info); Index: org/postgresql/core/v3/ProtocolConnectionImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v3/ProtocolConnectionImpl.java,v retrieving revision 1.13 diff -r1.13 ProtocolConnectionImpl.java 93c93 < cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort()); --- > cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort(), pgStream.getSocketFactory());