ResetAbandonedTimer (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.tomcat.jdbc.pool.interceptor, class: ResetAbandonedTimer

# Class ResetAbandonedTimer

java.lang.Object
org.apache.tomcat.jdbc.pool.JdbcInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer

All Implemented Interfaces:
  `InvocationHandler, ResetAbandonedTimerMBean`

public class ResetAbandonedTimer extends AbstractQueryReport implements ResetAbandonedTimerMBean
Class that resets the abandoned timer on any activity on the Connection or any successful query executions. This interceptor is useful for when you have a `PoolConfiguration.setRemoveAbandonedTimeout(int)` that is fairly low, and you want to reset the abandoned time each time any operation on the connection is performed This is useful for batch processing programs that use connections for extensive amount of times.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class AbstractQueryReport

  `AbstractQueryReport.StatementProxy`

- ## Field Summary

  ### Fields inherited from class AbstractQueryReport

  `threshold`

  ### Fields inherited from class AbstractCreateStatementInterceptor

  `constructors, CREATE_STATEMENT, CREATE_STATEMENT_IDX, EXECUTE, EXECUTE_BATCH, EXECUTE_QUERY, EXECUTE_TYPES, EXECUTE_UPDATE, GET_GENERATED_KEYS, GET_RESULTSET, GET_STATEMENT, PREPARE_CALL, PREPARE_CALL_IDX, PREPARE_STATEMENT, PREPARE_STATEMENT_IDX, RESULTSET_IDX, STATEMENT_TYPE_COUNT, STATEMENT_TYPES`

  ### Fields inherited from class JdbcInterceptor

  `CLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResetAbandonedTimer()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `closeInvoked()`
  Method invoked when the operation `Connection.close()` is invoked.
  `Object`
  `invoke(Object proxy, Method method, Object[] args)`
  Gets invoked each time an operation on `Connection` is invoked.
  `protected void`
  `prepareCall(String query, long time)`
  Invoked when prepareCall has been called and completed.
  `protected void`
  `prepareStatement(String sql, long time)`
  Invoked when prepareStatement has been called and completed.
  `protected String`
  `reportQuery(String query, Object[] args, String name, long start, long delta)`
  Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold
  `protected String`
  `reportSlowQuery(String query, Object[] args, String name, long start, long delta)`
  Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold
  `void`
  `reset(ConnectionPool parent, PooledConnection con)`
  no-op for this interceptor. no state is stored.
  `boolean`
  `resetTimer()`
  Reset the abandoned timer for the pooled connection.

  ### Methods inherited from class AbstractQueryReport

  `createStatement, getThreshold, reportFailedQuery, setThreshold`

  ### Methods inherited from class AbstractCreateStatementInterceptor

  `getConstructor, isExecute, isStatement, process`

  ### Methods inherited from class JdbcInterceptor

  `compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ResetAbandonedTimer

    public ResetAbandonedTimer()
    Default constructor.

- ## Method Details

  - ### reset

    public void reset(ConnectionPool parent, PooledConnection con)
    Description copied from class: `AbstractCreateStatementInterceptor`
    no-op for this interceptor. no state is stored.
    Overrides:
      `reset` in class `AbstractCreateStatementInterceptor`
    Parameters:
      `parent` - - the connection pool owning the connection
      `con` - - the pooled connection

  - ### resetTimer

    public boolean resetTimer()
    Description copied from interface: `ResetAbandonedTimerMBean`
    Reset the abandoned timer for the pooled connection.
    Specified by:
      `resetTimer` in interface `ResetAbandonedTimerMBean`
    Returns:
      True if the timer was reset, false if no connection is associated

  - ### invoke

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
    Description copied from class: `JdbcInterceptor`
    Gets invoked each time an operation on `Connection` is invoked.
    Specified by:
      `invoke` in interface `InvocationHandler`
    Overrides:
      `invoke` in class `AbstractCreateStatementInterceptor`
    Throws:
      `Throwable`

  - ### prepareCall

    protected void prepareCall(String query, long time)
    Description copied from class: `AbstractQueryReport`
    Invoked when prepareCall has been called and completed.
    Specified by:
      `prepareCall` in class `AbstractQueryReport`
    Parameters:
      `query` - - the string used to prepare the statement with
      `time` - - the time it took to invoke prepare

  - ### prepareStatement

    protected void prepareStatement(String sql, long time)
    Description copied from class: `AbstractQueryReport`
    Invoked when prepareStatement has been called and completed.
    Specified by:
      `prepareStatement` in class `AbstractQueryReport`
    Parameters:
      `sql` - - the string used to prepare the statement with
      `time` - - the time it took to invoke prepare

  - ### closeInvoked

    public void closeInvoked()
    Description copied from class: `AbstractCreateStatementInterceptor`
    Method invoked when the operation `Connection.close()` is invoked.
    Specified by:
      `closeInvoked` in class `AbstractCreateStatementInterceptor`

  - ### reportQuery

    protected String reportQuery(String query, Object[] args, String name, long start, long delta)
    Description copied from class: `AbstractQueryReport`
    Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold
    Overrides:
      `reportQuery` in class `AbstractQueryReport`
    Parameters:
      `query` - the query that was executed and failed
      `args` - the arguments to the execution
      `name` - the name of the method used to execute `AbstractCreateStatementInterceptor.isExecute(Method, boolean)`
      `start` - the time the query execution started
      `delta` - the time the execution took
    Returns:
      - the SQL that was executed or the string "batch" if it was a batch execution

  - ### reportSlowQuery

    protected String reportSlowQuery(String query, Object[] args, String name, long start, long delta)
    Description copied from class: `AbstractQueryReport`
    Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold
    Overrides:
      `reportSlowQuery` in class `AbstractQueryReport`
    Parameters:
      `query` - the query that was executed and failed
      `args` - the arguments to the execution
      `name` - the name of the method used to execute `AbstractCreateStatementInterceptor.isExecute(Method, boolean)`
      `start` - the time the query execution started
      `delta` - the time the execution took
    Returns:
      - the SQL that was executed or the string "batch" if it was a batch execution