Class DisposableTemplate

  • All Implemented Interfaces:
    Disposable, java.io.Serializable

    public abstract class DisposableTemplate
    extends java.lang.Object
    implements Disposable, java.io.Serializable
    Template providing disposable functionality. It makes notification of the GCEPS.
    Since:
    1.0
    See Also:
    doDispose(), MetaErrorListeners, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DisposableTemplate()
      The Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void assertNotDisposed()
      Auxiliary method to ensure that the object is not disposed.
      void dispose()
      Dispose object.
      protected abstract void doDispose()
      The Template method is called once during disposing.
      static long getNonDisposedObjectCounter()
      Get the current number of created but not disposed object which have DisposableTemplate as super class.
      boolean isDisposed()
      Check that the object is disposed.
      • Methods inherited from class java.lang.Object

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

      • DISPOSABLE_OBJECT_COUNTER

        private static final java.util.concurrent.atomic.AtomicLong DISPOSABLE_OBJECT_COUNTER
      • disposedFlag

        private final java.util.concurrent.atomic.AtomicBoolean disposedFlag
    • Constructor Detail

      • DisposableTemplate

        @Warning("Must be called in successors")
        public DisposableTemplate()
        The Constructor.
        Since:
        1.0
    • Method Detail

      • assertNotDisposed

        protected void assertNotDisposed()
        Auxiliary method to ensure that the object is not disposed.
        Throws:
        AlreadyDisposedError - if the object has been already disposed, with notification of the global error listeners
        Since:
        1.0
      • isDisposed

        public boolean isDisposed()
        Description copied from interface: Disposable
        Check that the object is disposed.
        Specified by:
        isDisposed in interface Disposable
        Returns:
        true if the object is disposed
      • dispose

        public final void dispose()
        Description copied from interface: Disposable
        Dispose object.
        Specified by:
        dispose in interface Disposable
      • getNonDisposedObjectCounter

        public static long getNonDisposedObjectCounter()
        Get the current number of created but not disposed object which have DisposableTemplate as super class.
        Returns:
        long value shows number of non-disposed objects.
        Since:
        1.0
      • doDispose

        protected abstract void doDispose()
        The Template method is called once during disposing.