1 28 29 30 package com.caucho.tools.profiler; 31 32 import javax.sql.ConnectionEventListener ; 33 import javax.sql.PooledConnection ; 34 import java.sql.Connection ; 35 import java.sql.SQLException ; 36 37 public final class PooledConnectionWrapper 38 implements PooledConnection 39 { 40 private final PooledConnection _connection; 41 private final ProfilerPoint _profilerPoint; 42 43 public PooledConnectionWrapper(ProfilerPoint profilerPoint, 44 PooledConnection connection) 45 { 46 _profilerPoint = profilerPoint; 47 _connection = connection; 48 } 49 50 private Connection wrap(Connection connection) 51 { 52 return new ConnectionWrapper(_profilerPoint, connection); 53 } 54 55 public Connection getConnection() 56 throws SQLException 57 { 58 return wrap(_connection.getConnection()); 59 } 60 61 public void close() 62 throws SQLException 63 { 64 _connection.close(); 65 } 66 67 public void addConnectionEventListener(ConnectionEventListener listener) 68 { 69 _connection.addConnectionEventListener(listener); 70 } 71 72 public void removeConnectionEventListener(ConnectionEventListener listener) 73 { 74 _connection.removeConnectionEventListener(listener); 75 } 76 77 public String toString() 78 { 79 return "PooledConnectionWrapper[" + _profilerPoint.getName() + "]"; 80 } 81 } 82 83 84 | Popular Tags |