Class InstanceTracker


  • public class InstanceTracker
    extends java.lang.Object
    Objects can register here when they are created. This class notices when it an object is garbage collected and keeps then track which instances are still running/alive. One can configure for which classes one is interested in seeing the created/removed delta. This is meant for debug/development purposes, to verify that cleanup is usually done properly, and not threads or objects stay unintentionally referenced and never get garbage collected. So while editing/testing, one sets the "which one to see" to the ones one want to monitor, but in productive use, i.e. when checked in to svn, this should be set to "don't show anything". (perhaps with Java 1.5 or 1.6, or a good debugger one can achieve the same effect, but I don't know how ;-)
    Author:
    Clemens Katzer
    • Constructor Summary

      Constructors 
      Constructor Description
      InstanceTracker()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean allGone()  
      private static java.lang.String getPrintStatistics()  
      static void printStatistics()  
      static void register​(java.lang.Object o, java.lang.String id)  
      static void setId​(java.lang.Object o, java.lang.String id)  
      • Methods inherited from class java.lang.Object

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

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • instanceGroups

        private static java.util.Map<java.lang.String,​InstanceGroup> instanceGroups
      • interestedIn

        private static java.util.Set<java.lang.String> interestedIn
      • interestedInAll

        private static boolean interestedInAll
      • ignoreDummyFrame

        private static boolean ignoreDummyFrame
    • Constructor Detail

      • InstanceTracker

        public InstanceTracker()
    • Method Detail

      • register

        public static void register​(java.lang.Object o,
                                    java.lang.String id)
      • setId

        public static void setId​(java.lang.Object o,
                                 java.lang.String id)
      • printStatistics

        public static void printStatistics()
      • getPrintStatistics

        private static java.lang.String getPrintStatistics()
      • allGone

        public static boolean allGone()