public class Pool extends Object implements Closeable
Each data set constructed using the Stream Factory will maintain a pool of readers in order to perform device lookup and retrieve various entities.
Used by the BaseList of type T to provide multiple readers for the list.
The Dataset must be disposed of to ensure the readers in the pool are closed.
Objects of this class should not be created directly as they are part of the internal logic.
The concept of the pool is slightly different to that, used in our C API. The C API also maintains a pool, but it is a pool of work sets where each work set is constructed from the data set and contains device information relevant to the device being detected. This pool only contains readers.
The number of readers created by the pool will typically be limited to the number of concurrent threads in operation. As such the number of readers will be relatively small and the Pool does not need to limit the maximum number that can be created.
| Constructor and Description |
|---|
Pool(SourceBase source)
Constructs a new pool of readers for the SourceBase provided.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
BinaryReader |
getReader()
Returns a reader to the temp file for exclusive use.
|
int |
getReadersCreated()
The number of readers that have been created.
|
int |
getReadersQueued()
Returns The number of readers in the queue.
|
void |
release(BinaryReader reader)
Returns the reader to the pool to be used by another process later.
|
public Pool(SourceBase source)
source - The data source for the list.public BinaryReader getReader() throws IOException
IOException - if there was a problem accessing data file.public void release(BinaryReader reader)
reader - Reader open and ready to read from the temp filepublic int getReadersCreated()
public int getReadersQueued()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017 51Degrees. All rights reserved.