Package org.jtrim2.concurrent.query.io
Interface InputStreamOpener
public interface InputStreamOpener
Defines an interface for opening a new input stream for reading. This
interface must open a new stream for each request.
Thread safety
Implementations of this interface must be safe to be accessed by multiple threads concurrently.Synchronization transparency
Implementations of this interface are not required to be synchronization transparent.-
Method Summary
Modifier and TypeMethodDescriptionopenStream(CancellationToken cancelToken) Opens a new stream to the source defined by thisInputStreamOpenerinstance.
-
Method Details
-
openStream
Opens a new stream to the source defined by thisInputStreamOpenerinstance. This method opens a new stream each time it is called an these opened channels must beclosedseparately.- Parameters:
cancelToken- theCancellationTokenthrough which callers may notify this method that the channel is no longer need to be opened. Implementations are free to ignore this request but if they don't, they must throw anOperationCanceledExceptionin response to the cancellation request. This argument cannot benull.- Returns:
- the new stream to the source defined by this
InputStreamOpenerinstance. The returned instance must beclosedin order to prevent resource leakage. This method never returnsnull. - Throws:
OperationCanceledException- thrown if cancellation was detected by this methodIOException- thrown if the stream could not be opened for some reasons
-