Class ConcurrentFileReader
java.lang.Object
org.aksw.jena_sparql_api.io.endpoint.ConcurrentFileReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel
A wrapper for a channel that blocks upon reaching the end of its channel
When there is no more data, the reader can either waits for a notify on referenceChannel.
or a poll using a specified interval.
The reference channel may be a channel that actually written to
by the JVM, but it may also be just a 'dummy' channel that represents a write process
outside of the JVM, such as a system process.
- Author:
- raven
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SeekableByteChannelprotected Integerprotected Channel -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentFileReader(Channel writeChannel, SeekableByteChannel currentReadChannel, Integer pollIntervalInMs) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static ConcurrentFileReaderbooleanbooleanisOpen()intread(ByteBuffer dst) Read method that blocks if no data is available but the write channel is still open
-
Field Details
-
referenceChannel
-
currentReadChannel
-
pollIntervalInMs
-
-
Constructor Details
-
ConcurrentFileReader
public ConcurrentFileReader(Channel writeChannel, SeekableByteChannel currentReadChannel, Integer pollIntervalInMs)
-
-
Method Details
-
create
public static ConcurrentFileReader create(Path path, Channel writeChannel, Integer pollIntervalInMs) throws IOException - Parameters:
path-writeChannel-pollIntervalInMs- Poll interval value or null in order to wait for notify on reference channel- Returns:
- Throws:
IOException
-
isOpen
public boolean isOpen() -
isAborted
public boolean isAborted() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
read
Read method that blocks if no data is available but the write channel is still open- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-