Java Code Examples for org.apache.tomcat.jdbc.pool.PooledConnection#setDiscarded()
The following examples show how to use
org.apache.tomcat.jdbc.pool.PooledConnection#setDiscarded() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Interceptor.java From jqm with Apache License 2.0 | 5 votes |
@Override public void reset(ConnectionPool parent, PooledConnection con) { if (con == null || !con.isInitialized() || con.isReleased() || !con.getConnection().getClass().toString().contains("racle")) { return; } try { String[] names = Thread.currentThread().getName().split(";"); String module = "'" + names[0] + "'"; String action = names.length > 1 ? "'" + names[1] + "'" : "NULL"; String clientInfo = names.length > 2 ? "'" + names[2] + "'" : "NULL"; Statement s = con.getConnection().createStatement(); s.execute("CALL DBMS_APPLICATION_INFO.SET_MODULE(" + module + ", " + action + ")"); s.execute("CALL DBMS_APPLICATION_INFO.SET_CLIENT_INFO(" + clientInfo + ")"); s.close(); } catch (SQLException e) { // Print (we do not have a logger here). And throw away the connection. e.printStackTrace(); con.setDiscarded(true); throw new RuntimeException(e); } }
Example 2
Source File: DalConnection.java From das with Apache License 2.0 | 4 votes |
private void markDiscard(Connection conn) throws SQLException { PooledConnection pConn = (PooledConnection)conn.unwrap(PooledConnection.class); pConn.setDiscarded(true); }
Example 3
Source File: DalConnection.java From dal with Apache License 2.0 | 4 votes |
private void markDiscard(Connection conn) throws SQLException { PooledConnection pConn = (PooledConnection) conn.unwrap(PooledConnection.class); pConn.setDiscarded(true); }