Class TrapException
java.lang.Object
org.apache.tomcat.jdbc.pool.JdbcInterceptor
org.apache.tomcat.jdbc.pool.TrapException
- All Implemented Interfaces:
InvocationHandler
Interceptor that traps any unhandled exception types and throws an exception that has been declared by the method
called, or throw an SQLException if it is declared. If the caught exception is not declared, and the method doesn't
throw SQLException, then this interceptor will throw a RuntimeException
-
Field Summary
Fields inherited from class JdbcInterceptor
ABORT_VAL, CLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VALModifier and TypeFieldDescriptionstatic final StringConnection.abort(java.util.concurrent.Executor)method namestatic final StringConnection.close()method namestatic final Stringstatic final StringPooledConnection.getConnection()method namestatic final Stringstatic final StringConnection.isClosed()method namestatic final StringConnection.isValid(int)method namestatic final StringWrapper.isWrapperFor(Class)method nameprotected Map<String, PoolProperties.InterceptorProperty> Properties for this interceptor.static final StringObject.toString()method namestatic final StringWrapper.unwrap(Class)method name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets invoked each time an operation onConnectionis invoked.booleanisDeclaredException(Method m, Class<?> clazz) Checks if the given exception class is declared in the throws clause of the specified method.voidreset(ConnectionPool parent, PooledConnection con) no-op for this interceptor. no state is stored.Methods inherited from class JdbcInterceptor
compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEqualsModifier and TypeMethodDescriptionbooleanCompares a method name (String) to a method (Method)JdbcInterceptor.compare(String,String)Uses reference comparison unless the useEquals property is set to truebooleanPerforms a string comparison, using references unless the useEquals property is set to true.voiddisconnected(ConnectionPool parent, PooledConnection con, boolean finalizing) Called whenConnection.close()is called on the underlying connection.getNext()Returns the next interceptor in the chainReturns the properties configured for this interceptorbooleanTrue if the compare method uses the Object.equals(Object) method, false if comparison is done on a reference level.voidpoolClosed(ConnectionPool pool) This method is invoked by a connection pool when the pool is closed.voidpoolStarted(ConnectionPool pool) This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested.voidsetNext(JdbcInterceptor next) configures the next interceptor in the chainvoidsetProperties(Map<String, PoolProperties.InterceptorProperty> properties) Called during the creation of an interceptor The properties can be set during the configuration of an interceptor Override this method to perform type casts between string values and object propertiesvoidsetUseEquals(boolean useEquals) Set to true if string comparisons (for theJdbcInterceptor.compare(String, Method)andJdbcInterceptor.compare(String, String)methods) should use the Object.equals(Object) method The default is false
-
Constructor Details
-
TrapException
public TrapException()Constructs a new TrapException interceptor.
-
-
Method Details
-
invoke
Description copied from class:JdbcInterceptorGets invoked each time an operation onConnectionis invoked.- Specified by:
invokein interfaceInvocationHandler- Overrides:
invokein classJdbcInterceptor- Throws:
Throwable
-
isDeclaredException
-
reset
no-op for this interceptor. no state is stored.- Specified by:
resetin classJdbcInterceptor- Parameters:
parent- - the connection pool owning the connectioncon- - the pooled connection
-