Class AbandonedTrace

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private AbandonedConfig config
      DBCP AbandonedConfig
      private java.lang.Exception createdBy
      A stack trace of the code that created me (if in debug mode)
      private long lastUsed
      Last time this connection was used
      private java.util.List traceList
      A list of objects created by children of this object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addTrace​(AbandonedTrace trace)
      Add an object to the list of objects being traced.
      protected void clearTrace()
      Clear the list of objects being traced by this object.
      protected AbandonedConfig getConfig()
      Get the abandoned config for this object.
      protected long getLastUsed()
      Get the last time this object was used in ms.
      protected java.util.List getTrace()
      Get a list of objects being traced by this object.
      private void init​(AbandonedTrace parent)
      Initialize abandoned tracing for this object.
      void printStackTrace()
      Prints a stack trace of the code that created this object.
      protected void removeTrace​(AbandonedTrace trace)
      Remove a child object this object is tracing.
      protected void setLastUsed()
      Set the time this object was last used to the current time in ms.
      protected void setLastUsed​(long time)
      Set the time in ms this object was last used.
      protected void setStackTrace()
      If logAbandoned=true generate a stack trace for this object then add this object to the parent object trace list.
      • Methods inherited from class java.lang.Object

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

      • createdBy

        private volatile java.lang.Exception createdBy
        A stack trace of the code that created me (if in debug mode)
      • traceList

        private final java.util.List traceList
        A list of objects created by children of this object
      • lastUsed

        private volatile long lastUsed
        Last time this connection was used
    • Constructor Detail

      • AbandonedTrace

        public AbandonedTrace()
        Create a new AbandonedTrace without config and without doing abandoned tracing.
      • AbandonedTrace

        public AbandonedTrace​(AbandonedConfig config)
        Construct a new AbandonedTrace with no parent object.
        Parameters:
        config - AbandonedConfig
      • AbandonedTrace

        public AbandonedTrace​(AbandonedTrace parent)
        Construct a new AbandonedTrace with a parent object.
        Parameters:
        parent - AbandonedTrace parent object
    • Method Detail

      • init

        private void init​(AbandonedTrace parent)
        Initialize abandoned tracing for this object.
        Parameters:
        parent - AbandonedTrace parent object
      • getConfig

        protected AbandonedConfig getConfig()
        Get the abandoned config for this object.
        Returns:
        AbandonedConfig for this object
      • getLastUsed

        protected long getLastUsed()
        Get the last time this object was used in ms.
        Returns:
        long time in ms
      • setLastUsed

        protected void setLastUsed()
        Set the time this object was last used to the current time in ms.
      • setLastUsed

        protected void setLastUsed​(long time)
        Set the time in ms this object was last used.
        Parameters:
        time - time in ms
      • setStackTrace

        protected void setStackTrace()
        If logAbandoned=true generate a stack trace for this object then add this object to the parent object trace list.
      • addTrace

        protected void addTrace​(AbandonedTrace trace)
        Add an object to the list of objects being traced.
        Parameters:
        trace - AbandonedTrace object to add
      • clearTrace

        protected void clearTrace()
        Clear the list of objects being traced by this object.
      • getTrace

        protected java.util.List getTrace()
        Get a list of objects being traced by this object.
        Returns:
        List of objects
      • printStackTrace

        public void printStackTrace()
        Prints a stack trace of the code that created this object.
      • removeTrace

        protected void removeTrace​(AbandonedTrace trace)
        Remove a child object this object is tracing.
        Parameters:
        trace - AbandonedTrace object to remove