? org/postgresql/core/AntiDeadlockStream.java Index: org/postgresql/core/PGStream.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/PGStream.java,v retrieving revision 1.22 diff -u -r1.22 PGStream.java --- org/postgresql/core/PGStream.java 8 Jan 2008 06:56:27 -0000 1.22 +++ org/postgresql/core/PGStream.java 22 Jan 2009 01:10:13 -0000 @@ -34,6 +34,7 @@ { private final String host; private final int port; + private final boolean antiDeadlock; private final byte[] _int4buf; private final byte[] _int2buf; @@ -52,12 +53,14 @@ * * @param host the hostname to connect to * @param port the port number that the postmaster is sitting on + * @param antiDeadlock true to insert an anti-deadlock outputstream * @exception IOException if an IOException occurs below it. */ - public PGStream(String host, int port) throws IOException + public PGStream(String host, int port, boolean antiDeadlock) throws IOException { this.host = host; this.port = port; + this.antiDeadlock = antiDeadlock; changeSocket(new Socket(host, port)); setEncoding(Encoding.getJVMEncoding("US-ASCII")); @@ -74,6 +77,10 @@ return port; } + public boolean getAntiDeadlock() { + return antiDeadlock; + } + public Socket getSocket() { return connection; } @@ -110,6 +117,8 @@ // Buffer sizes submitted by Sverre H Huseby pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192); pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192); + if (antiDeadlock) + pg_output = new AntiDeadlockStream(pg_output, 8192, 30000); if (encoding != null) setEncoding(encoding); Index: org/postgresql/core/v2/ConnectionFactoryImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v2/ConnectionFactoryImpl.java,v retrieving revision 1.17 diff -u -r1.17 ConnectionFactoryImpl.java --- org/postgresql/core/v2/ConnectionFactoryImpl.java 30 Sep 2008 03:42:48 -0000 1.17 +++ org/postgresql/core/v2/ConnectionFactoryImpl.java 22 Jan 2009 01:10:14 -0000 @@ -59,7 +59,7 @@ PGStream newStream = null; try { - newStream = new PGStream(host, port); + newStream = new PGStream(host, port, Boolean.valueOf(info.getProperty("antiDeadlock")).booleanValue()); // Construct and send an ssl startup packet if requested. if (trySSL) @@ -147,7 +147,7 @@ // We have to reconnect to continue. pgStream.close(); - return new PGStream(pgStream.getHost(), pgStream.getPort()); + return new PGStream(pgStream.getHost(), pgStream.getPort(), pgStream.getAntiDeadlock()); case 'N': if (logger.logDebug()) Index: org/postgresql/core/v2/ProtocolConnectionImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v2/ProtocolConnectionImpl.java,v retrieving revision 1.12 diff -u -r1.12 ProtocolConnectionImpl.java --- org/postgresql/core/v2/ProtocolConnectionImpl.java 1 Apr 2008 07:19:20 -0000 1.12 +++ org/postgresql/core/v2/ProtocolConnectionImpl.java 22 Jan 2009 01:10:14 -0000 @@ -90,7 +90,7 @@ if (logger.logDebug()) logger.debug(" FE=> CancelRequest(pid=" + cancelPid + ",ckey=" + cancelKey + ")"); - cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort()); + cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort(), false); cancelStream.SendInteger4(16); cancelStream.SendInteger2(1234); cancelStream.SendInteger2(5678); Index: org/postgresql/core/v3/ConnectionFactoryImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v3/ConnectionFactoryImpl.java,v retrieving revision 1.19 diff -u -r1.19 ConnectionFactoryImpl.java --- org/postgresql/core/v3/ConnectionFactoryImpl.java 29 Nov 2008 07:40:30 -0000 1.19 +++ org/postgresql/core/v3/ConnectionFactoryImpl.java 22 Jan 2009 01:10:14 -0000 @@ -73,7 +73,7 @@ PGStream newStream = null; try { - newStream = new PGStream(host, port); + newStream = new PGStream(host, port, Boolean.valueOf(info.getProperty("antiDeadlock")).booleanValue()); // Construct and send an ssl startup packet if requested. if (trySSL) @@ -178,7 +178,7 @@ // We have to reconnect to continue. pgStream.close(); - return new PGStream(pgStream.getHost(), pgStream.getPort()); + return new PGStream(pgStream.getHost(), pgStream.getPort(), pgStream.getAntiDeadlock()); case 'N': if (logger.logDebug()) Index: org/postgresql/core/v3/ProtocolConnectionImpl.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v3/ProtocolConnectionImpl.java,v retrieving revision 1.13 diff -u -r1.13 ProtocolConnectionImpl.java --- org/postgresql/core/v3/ProtocolConnectionImpl.java 1 Apr 2008 07:19:20 -0000 1.13 +++ org/postgresql/core/v3/ProtocolConnectionImpl.java 22 Jan 2009 01:10:14 -0000 @@ -90,7 +90,7 @@ if (logger.logDebug()) logger.debug(" FE=> CancelRequest(pid=" + cancelPid + ",ckey=" + cancelKey + ")"); - cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort()); + cancelStream = new PGStream(pgStream.getHost(), pgStream.getPort(), false); cancelStream.SendInteger4(16); cancelStream.SendInteger2(1234); cancelStream.SendInteger2(5678);