@ Override public Connection getConnection ( ) throws SQLException { Connection conn = super . getConnection ( ) ; // When we're outside an XA transaction, autocommit // is supposed to be true, per usual JDBC convention. // When an XA transaction is in progress, it should be // false. if ( state == State . IDLE ) { conn . setAutoCommit ( true ) ; } /* * Wrap the connection in a proxy to forbid application from fiddling with transaction state * directly during an XA transaction */ ConnectionHandler handler = new ConnectionHandler ( conn ) ; return ( Connection ) Proxy . newProxyInstance ( getClass ( ) . getClassLoader ( ) , new Class [ ] { Connection . class , PGConnection . class } , handler ) ; }
XAConnection interface .