Usage:
cleanableState.doClean() method to perform all the necessary cleanup steps.close(), it's a good practice to have it just call
cleanableState.runCleaner().Implementation details:
Cleaner is used under the hood.finalize() calls doClean() directly.| Modifier and Type | Field and Description |
|---|---|
| private final Cleaner. | |
| private static final Cleaner |
| Access | Constructor and Description |
|---|---|
| protected | CleanableState(Object
The observed instance (the outer class referencing this
observed)CleanableState).Creates a state object to be used as an implementation detail of the specified observed instance. |
| Modifier and Type | Method and Description |
|---|---|
| public final void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| protected abstract void | |
| public final void |
| cleanable | back to summary |
|---|---|
| private final Cleaner. | |
| CLEANER | back to summary |
|---|---|
| private static final Cleaner CLEANER | |
| CleanableState | back to summary |
|---|---|
| protected CleanableState(Object observed) Creates a state object to be used as an implementation detail of the specified observed instance.
| |
| close | back to summary |
|---|---|
| public final void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| doClean | back to summary |
|---|---|
| protected abstract void doClean() Performs the actual cleanup. | |
| runCleaner | back to summary |
|---|---|
| public final void runCleaner() Explicitly the cleanup code defined in | |