Class AbandonedConfig


  • public class AbandonedConfig
    extends java.lang.Object
    Configuration settings for handling abandoned db connections.
    Version:
    $Revision: 758745 $ $Date: 2009-03-26 13:02:20 -0400 (Thu, 26 Mar 2009) $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean logAbandoned
      Determines whether or not to log stack traces for application code which abandoned a Statement or Connection.
      private java.io.PrintWriter logWriter
      PrintWriter to use to log information on abandoned objects.
      private boolean removeAbandoned
      Whether or not a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout
      private int removeAbandonedTimeout
      Timeout in seconds before an abandoned connection can be removed
    • Constructor Summary

      Constructors 
      Constructor Description
      AbandonedConfig()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean getLogAbandoned()
      Flag to log stack traces for application code which abandoned a Statement or Connection.
      java.io.PrintWriter getLogWriter()
      Returns the log writer being used by this configuration to log information on abandoned objects.
      boolean getRemoveAbandoned()
      Flag to remove abandoned connections if they exceed the removeAbandonedTimeout.
      int getRemoveAbandonedTimeout()
      Timeout in seconds before an abandoned connection can be removed.
      void setLogAbandoned​(boolean logAbandoned)
      Flag to log stack traces for application code which abandoned a Statement or Connection.
      void setLogWriter​(java.io.PrintWriter logWriter)
      Sets the log writer to be used by this configuration to log information on abandoned objects.
      void setRemoveAbandoned​(boolean removeAbandoned)
      Flag to remove abandoned connections if they exceed the removeAbandonedTimeout.
      void setRemoveAbandonedTimeout​(int removeAbandonedTimeout)
      Timeout in seconds before an abandoned connection can be removed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • removeAbandoned

        private boolean removeAbandoned
        Whether or not a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout
      • removeAbandonedTimeout

        private int removeAbandonedTimeout
        Timeout in seconds before an abandoned connection can be removed
      • logAbandoned

        private boolean logAbandoned
        Determines whether or not to log stack traces for application code which abandoned a Statement or Connection.
      • logWriter

        private java.io.PrintWriter logWriter
        PrintWriter to use to log information on abandoned objects.
    • Constructor Detail

      • AbandonedConfig

        public AbandonedConfig()
    • Method Detail

      • getRemoveAbandoned

        public boolean getRemoveAbandoned()
        Flag to remove abandoned connections if they exceed the removeAbandonedTimeout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.
        Returns:
        true if abandoned connections are to be removed
      • setRemoveAbandoned

        public void setRemoveAbandoned​(boolean removeAbandoned)
        Flag to remove abandoned connections if they exceed the removeAbandonedTimeout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.
        Parameters:
        removeAbandoned - true means abandoned connections will be removed
      • getRemoveAbandonedTimeout

        public int getRemoveAbandonedTimeout()
        Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds.
        Returns:
        abandoned timeout in seconds
      • setRemoveAbandonedTimeout

        public void setRemoveAbandonedTimeout​(int removeAbandonedTimeout)
        Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds.
        Parameters:
        removeAbandonedTimeout - abandoned timeout in seconds
      • getLogAbandoned

        public boolean getLogAbandoned()
        Flag to log stack traces for application code which abandoned a Statement or Connection. Defaults to false. Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.
        Returns:
        boolean true if stack trace logging is turned on for abandoned Statements or Connections
      • setLogAbandoned

        public void setLogAbandoned​(boolean logAbandoned)
        Flag to log stack traces for application code which abandoned a Statement or Connection. Defaults to false. Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.
        Parameters:
        logAbandoned - true turns on abandoned stack trace logging
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
        Returns the log writer being used by this configuration to log information on abandoned objects. If not set, a PrintWriter based on System.out is used.
        Returns:
        log writer in use
      • setLogWriter

        public void setLogWriter​(java.io.PrintWriter logWriter)
        Sets the log writer to be used by this configuration to log information on abandoned objects.
        Parameters:
        logWriter - The new log writer