TError - type of error when closing.public abstract class ConcurrentCloseable<TError extends Exception> extends Object implements IConcurrentCloseable<TError>
CloseableListenable.Impl| Constructor and Description |
|---|
ConcurrentCloseable() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(Consumer<CloseableListenable> listener)
Add a listener to be called once this resource is closed.
|
void |
addCloseListener(Runnable listener)
Add a listener to be called once this resource is closed.
|
void |
close()
Close.
|
IAsync<TError> |
closeAsync()
Close asynchronously.
|
protected abstract void |
closeResources(Async<TError> ondone) |
protected abstract IAsync<TError> |
closeUnderlyingResources() |
abstract byte |
getPriority()
Return the priority.
|
boolean |
isClosed()
Return true if closed.
|
boolean |
isClosing() |
boolean |
lockClose()
Calling this method avoid this resource to be closed.
|
protected <TE extends Exception,T extends IAsync<TE>> |
operation(T op) |
protected <TE extends Exception,TR,T extends Task<TR,TE>> |
operation(T task) |
void |
removeCloseListener(Consumer<CloseableListenable> listener)
Remove a listener.
|
void |
removeCloseListener(Runnable listener)
Remove a listener.
|
void |
unlockClose()
Allow to close this resource, if this is the last lock on it.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseAfterpublic abstract byte getPriority()
public boolean isClosing()
public boolean isClosed()
CloseableListenableisClosed in interface CloseableListenablepublic void addCloseListener(Consumer<CloseableListenable> listener)
CloseableListenableaddCloseListener in interface CloseableListenablepublic void addCloseListener(Runnable listener)
CloseableListenableaddCloseListener in interface CloseableListenablepublic void removeCloseListener(Consumer<CloseableListenable> listener)
CloseableListenableremoveCloseListener in interface CloseableListenablepublic void removeCloseListener(Runnable listener)
CloseableListenableremoveCloseListener in interface CloseableListenablepublic boolean lockClose()
IConcurrentCloseablelockClose in interface IConcurrentCloseable<TError extends Exception>public void unlockClose()
IConcurrentCloseableunlockClose in interface IConcurrentCloseable<TError extends Exception>public void close()
throws Exception
CloseableListenableclose in interface AutoCloseableclose in interface CloseableListenableExceptionpublic IAsync<TError> closeAsync()
AsyncCloseablecloseAsync in interface AsyncCloseable<TError extends Exception>Copyright © 2019. All rights reserved.