@NoImplement public interface CursorProvider<T extends Cursor>
Cursor
which allows concurrent access to a wrapped
stream.
The provider maintains all the allocated resources necessary to power all the open cursors.
When this provider is closed
, it will not open any new cursors
and invokations to openCursor()
will fail. However, the allocated resources
will not be released until all open cursors are closed. The runtime will be in charge of
doing that, no intervention is required from the client.
CursorStream
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the provider in the sense that it will not yield any more cursors.
|
boolean |
isClosed() |
T |
openCursor()
Creates a new
Cursor of type T positioned on the very beginning of the wrapped stream. |
void |
releaseResources()
Releases all the resources currently held by this provider.
|
T openCursor()
Cursor
of type T
positioned on the very beginning of the wrapped stream.
Notices that this method enables concurrent random access by providing the ability to open
several cursors. However, each cursor should not be used concurrently since Cursor
does not guarantee thread safeness.
It is the invokers responsibility to make sure that the returned cursor gets closed, since otherwise whatever resources held by the underlying buffer will never be released.
CursorStream
IllegalStateException
- if invoked after the close()
method has been invokedvoid close()
this
provider will be released.void releaseResources()
cursors
generated by
this
provider will cease to function, which means that this method should only be invoked once
the close()
has already been invoked (to prevent new cursors from being opened) and all the current ones
have already been released.
This method should ONLY be invoked by the runtime
boolean isClosed()
close()
method has been invoked on this
instance or notCopyright © 2018. All rights reserved.