Class DisposableTemplate
java.lang.Object
com.igormaznitsa.meta.common.templates.DisposableTemplate
- All Implemented Interfaces:
Disposable
,Serializable
Template providing disposable functionality. It makes notification of the GCEPS.
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AtomicLong
private final AtomicBoolean
private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Auxiliary method to ensure that the object is not disposed.final void
dispose()
Dispose object.protected abstract void
The Template method is called once during disposing.static long
Get the current number of created but not disposed object which have DisposableTemplate as super class.boolean
Check that the object is disposed.
-
Field Details
-
DISPOSABLE_OBJECT_COUNTER
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
disposedFlag
-
-
Constructor Details
-
DisposableTemplate
The Constructor.- Since:
- 1.0
-
-
Method Details
-
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 interfaceDisposable
- Returns:
- true if the object is disposed
-
dispose
public final void dispose()Description copied from interface:Disposable
Dispose object.- Specified by:
dispose
in interfaceDisposable
-
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.
-