|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asyncobjects.AsyncUnicastServer<FacetType> net.sf.asyncobjects.util.CloseableWrapper<FacetType,WrappedType>
FacetType
- A facet stream typeWrappedType
- A wrapped stream typepublic abstract class CloseableWrapper<FacetType extends ACloseable,WrappedType extends ACloseable>
This is a base class for closeables that built upon other closeable objects.
The class is mostly used of for IO. However it could be useful for
implementing other resources that implement ACloseable
interface.
Nested Class Summary | |
---|---|
protected class |
CloseableWrapper.InvalidatingWhen<I,R>
When that invalidates the stream in case of exception |
Field Summary | |
---|---|
protected boolean |
closeWrapper
if true, inner stream should be closed |
protected RequestQueue |
requests
a request queue |
protected WrappedType |
wrapped
wrapped closeable |
Constructor Summary | |
---|---|
CloseableWrapper(WrappedType stream,
boolean closeWrapper)
A constructor |
Method Summary | |
---|---|
protected void |
afterInvalidate(Throwable problem)
Perform additional invalidation for the stream. |
protected Promise<Void> |
beforeClose()
Handle close operation |
Promise<Void> |
close()
Close resource |
Promise<Void> |
closed()
|
protected void |
ensureOpen()
Ensure that stream is open |
protected void |
ensureValid()
Ensure that stream is valid. |
protected void |
invalidate(Throwable problem)
Invalidate the closeable |
protected boolean |
isValid()
|
Methods inherited from class net.sf.asyncobjects.AsyncUnicastServer |
---|
dereference, export, isImmediate, myVat, promise |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.asyncobjects.AsyncObject |
---|
dereference, isImmediate |
Field Detail |
---|
protected final RequestQueue requests
protected final WrappedType extends ACloseable wrapped
protected final boolean closeWrapper
Constructor Detail |
---|
public CloseableWrapper(WrappedType stream, boolean closeWrapper)
stream
- inner stream to work withcloseWrapper
- if true inner stream will be closed when close operation
executed.Method Detail |
---|
public Promise<Void> closed()
public Promise<Void> close()
ACloseable
close
in interface ACloseable
ACloseable.close()
protected final void ensureValid()
protected final void ensureOpen()
protected void afterInvalidate(Throwable problem)
problem
- a problem.protected Promise<Void> beforeClose() throws Throwable
Throwable
- if there is aproblem during executionprotected final void invalidate(Throwable problem)
problem
- a problem that caused invalidation or nullprotected boolean isValid()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |