public abstract class SimpleCloseable extends Object implements Closeable, ReferenceOwner, ManagedCloseable
Closeable, ReferenceOwner, and ManagedCloseable interfaces.
It maintains a flag to track the closed state of the resource and provides methods for closing the resource.INIT, TMP| Modifier | Constructor and Description |
|---|---|
protected |
SimpleCloseable()
Constructs a new instance of
SimpleCloseable. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the resource so that it cannot be used again.
|
boolean |
isClosed()
Checks if the resource is closed.
|
protected void |
performClose()
Performs the actual close operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreferenceId, referenceName, temporarycreatedHere, throwExceptionIfClosed, warnAndCloseIfNotClosedcloseQuietly, closeQuietlyisClosingprotected SimpleCloseable()
SimpleCloseable.
This constructor is protected to encourage inheritance and prevent direct instantiation.public final void close()
close in interface Closeableclose in interface AutoCloseableAbstractCloseable.performClose()protected void performClose()
Call close() to ensure this is called exactly once.
public boolean isClosed()
isClosed in interface QueryCloseabletrue if the resource is closed, false otherwise.Copyright © 2024. All rights reserved.