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 AtomicLongprivate final AtomicBooleanprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAuxiliary method to ensure that the object is not disposed.final voiddispose()Dispose object.protected abstract voidThe Template method is called once during disposing.static longGet the current number of created but not disposed object which have DisposableTemplate as super class.booleanCheck that the object is disposed.
-
Field Details
-
DISPOSABLE_OBJECT_COUNTER
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
disposedFlag
-
-
Constructor Details
-
DisposableTemplate
-
-
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:DisposableCheck that the object is disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if the object is disposed
-
dispose
public final void dispose()Description copied from interface:DisposableDispose object.- Specified by:
disposein 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.
-