public class RecordingDescriptorCollector extends Object
RecordingDescriptors. This aims to be memory and allocation
efficient by pooling instances of the descriptors. The user must decide on the size of the pool at allocation
time. If the pool size is set to 0 then no pooling will occur and all instances will be recreated.
This may be desirable if the user wanted to hold onto descriptors over multiple calls to
AeronArchive's list recording methods. If the user wants to have pooling, but needs to retain some
instances, then they can call the retain method on the RecordingDescriptor.
final int pageSize;
final RecordingDescriptorCollector collector = new RecordingDescriptorCollector(pageSize);
int count;
long fromRecordingId = 0;
while (0 != (count = aeronArchive.listRecordings(fromRecordingId, pageSize, collector.reset())
{
for (final RecordingDescriptor descriptor : collector.descriptors())
{
if (\/* some interesting condition *\/)
{
// Want to hang onto this one...
descriptor.retain();
}
}
fromRecordingId += count;
}
| Constructor and Description |
|---|
RecordingDescriptorCollector(int poolSize)
Construct the collector with the specified pool size.
|
| Modifier and Type | Method and Description |
|---|---|
List<RecordingDescriptor> |
descriptors()
The results from the list of recording descriptors.
|
int |
poolSize()
The configured pool size.
|
RecordingDescriptorConsumer |
reset()
Reset the result list for the collector.
|
public RecordingDescriptorCollector(int poolSize)
reset(). Therefore, setting poolSize to 0 will
effectively disable pooling.poolSize - size of the descriptor poolpublic RecordingDescriptorConsumer reset()
AeronArchives's list recording methods.public List<RecordingDescriptor> descriptors()
reset() is called and refilled on subsequent queries.public int poolSize()
Copyright © 2014-2023 Real Logic Limited. All Rights Reserved.