Revision 46361 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/JDBCConnectionBase.java
JDBCConnectionBase.java | ||
---|---|---|
28 | 28 |
private Connection conn; |
29 | 29 |
private DataTransactionServices transaction; |
30 | 30 |
private final String id; |
31 |
private final ConnectionProvider connectionProvider; |
|
31 | 32 |
|
32 | 33 |
private static class DataSQLException extends DataException { |
33 | 34 |
|
... | ... | |
37 | 38 |
} |
38 | 39 |
|
39 | 40 |
public JDBCConnectionBase(DataTransactionServices transaction,Connection conn, String id) { |
41 |
this(transaction, conn, id, null); |
|
42 |
} |
|
43 |
|
|
44 |
public JDBCConnectionBase(DataTransactionServices transaction,Connection conn, String id, ConnectionProvider connectionProvider) { |
|
40 | 45 |
this.id = id; |
41 | 46 |
this.transaction = transaction; |
42 | 47 |
this.conn = conn; |
43 | 48 |
if( this.transaction!=null ) { |
44 | 49 |
this.transaction.addConnection(this); |
45 | 50 |
} |
51 |
this.connectionProvider = connectionProvider; |
|
52 |
if( LOGGER.isDebugEnabled() ) { |
|
53 |
if( this.connectionProvider!=null ) { |
|
54 |
LOGGER.debug("CONN INIT "+JDBCUtils.getConnId(this.conn)+" trans: "+JDBCUtils.getHexId(this.transaction)+" status: "+this.connectionProvider.getStatus()); |
|
55 |
} else { |
|
56 |
LOGGER.debug("CONN INIT "+JDBCUtils.getConnId(this.conn)+" trans: "+JDBCUtils.getHexId(this.transaction)+" status: UNKNOWN"); |
|
57 |
} |
|
58 |
} |
|
46 | 59 |
} |
47 | 60 |
|
48 | 61 |
@Override |
... | ... | |
52 | 65 |
|
53 | 66 |
@Override |
54 | 67 |
public void close() throws SQLException { |
68 |
String connid = JDBCUtils.getConnId(this.conn); |
|
55 | 69 |
if( this.transaction!=null ) { |
70 |
if( LOGGER.isDebugEnabled() ) { |
|
71 |
if( this.connectionProvider==null ) { |
|
72 |
LOGGER.debug("CONN SKIP CLOSE "+connid+" trans: "+JDBCUtils.getHexId(this.transaction)+" status: UNKNOWN"); |
|
73 |
} else { |
|
74 |
LOGGER.debug("CONN SKIP CLOSE "+connid+" trans: "+JDBCUtils.getHexId(this.transaction)+" status: "+this.connectionProvider.getStatus()); |
|
75 |
} |
|
76 |
} |
|
56 | 77 |
return; |
57 | 78 |
} |
58 |
this.conn.close(); |
|
79 |
this.conn.close(); |
|
80 |
if( LOGGER.isDebugEnabled() ) { |
|
81 |
if( this.connectionProvider==null ) { |
|
82 |
LOGGER.debug("CONN CLOSE "+connid+" trans: NULL status: UNKNOWN"); |
|
83 |
} else { |
|
84 |
LOGGER.debug("CONN CLOSE "+connid+" trans: NULL status: "+this.connectionProvider.getStatus()); |
|
85 |
} |
|
86 |
} |
|
59 | 87 |
} |
60 | 88 |
|
61 | 89 |
@Override |
... | ... | |
139 | 167 |
} catch(Exception ex) { |
140 | 168 |
LOGGER.debug("",ex); |
141 | 169 |
} |
142 |
JDBCUtils.closeQuietly(conn); |
|
170 |
String connid = JDBCUtils.getConnId(this.conn); |
|
171 |
this.conn.close(); |
|
172 |
if( LOGGER.isDebugEnabled() ) { |
|
173 |
if( this.connectionProvider==null ) { |
|
174 |
LOGGER.debug("CONN CLOSE "+connid+" trans: NULL status: UNKNOWN"); |
|
175 |
} else { |
|
176 |
LOGGER.debug("CONN CLOSE "+connid+" trans: NULL status: "+this.connectionProvider.getStatus()); |
|
177 |
} |
|
178 |
} |
|
143 | 179 |
this.conn = null; |
144 | 180 |
this.transaction = null; |
145 | 181 |
} catch(Exception ex) { |
Also available in: Unified diff