public interface QDAgent extends RecordProvider, SubscriptionContainer, QDStatsContainer
QDAgent
represents an individual data consumer in the QDCollector
.
It is responsible for tracking state of the consumer in the collector, including its
total subscription and accumulated data, and to provide access point for that consumer.Modifier and Type | Interface and Description |
---|---|
static interface |
QDAgent.AttachmentStrategy<T> |
static class |
QDAgent.BufferOverflowStrategy
Strategy for handling of stream and history buffer overflow events.
|
static interface |
QDAgent.Builder
Builder for collector agents.
|
VOID
Modifier and Type | Method and Description |
---|---|
void |
addSubscription(RecordSource source)
Adds specified subscription to this agent's data interest.
|
void |
addSubscription(SubscriptionIterator iterator)
Deprecated.
|
int |
addSubscriptionPart(RecordSource source,
int notify)
Adds part of a specified subscription to this agent's data interest.
|
void |
close()
Closes this agent and releases allocated resources in its
QDCollector . |
void |
closeAndExamineDataBySubscription(RecordSink sink)
Closes this agent and with
close() and atomically examines all data that is
available for this agent in the collector storage. |
int |
closePart(int notify)
Closes part of this agent and releases allocated resources in its
QDCollector . |
SubscriptionConsumer |
getAddingSubscriptionConsumer()
Deprecated.
|
SubscriptionConsumer |
getRemovingSubscriptionConsumer()
Deprecated.
|
RecordProvider |
getSnapshotProvider()
Returns record provider that is used to retrieve only snapshot from Ticker and History.
|
void |
removeSubscription(RecordSource source)
Removes specified subscription from this agent's data interest.
|
void |
removeSubscription(SubscriptionIterator iterator)
Deprecated.
|
int |
removeSubscriptionPart(RecordSource source,
int notify)
Removes part of specified subscription from this agent's data interest.
|
void |
setBufferOverflowStrategy(int max_buffer_size,
boolean drop_oldest,
boolean log_overflow)
Deprecated.
|
void |
setBufferOverflowStrategy(QDAgent.BufferOverflowStrategy bufferOverflowStrategy)
Sets new strategy for handling of stream and history buffer overflow events.
|
void |
setMaxBufferSize(int maxBufferSize)
Sets max buffers size for stream and history agents.
|
void |
setStreamOverflowStrategy(int max_buffer_size,
boolean drop_oldest,
boolean log_overflow)
Deprecated.
|
void |
setSubscription(RecordSource source)
Sets specified subscription to be this agent's data interest.
|
void |
setSubscription(SubscriptionIterator iterator)
Deprecated.
|
int |
setSubscriptionPart(RecordSource source,
int notify)
Sets part of specified subscription to be this agent's data interest.
|
getMode, retrieve, retrieveData, retrieveSubscription, setDataListener, setRecordListener, setSubscriptionListener
examineSubscription, examineSubscription, getSubscriptionSize, isSubscribed
getStats
RecordProvider getSnapshotProvider()
SubscriptionConsumer getAddingSubscriptionConsumer()
addSubscription(com.devexperts.qd.SubscriptionIterator)
method.addSubscription(com.devexperts.qd.SubscriptionIterator)
method.SubscriptionConsumer getRemovingSubscriptionConsumer()
removeSubscription(com.devexperts.qd.SubscriptionIterator)
method.removeSubscription(com.devexperts.qd.SubscriptionIterator)
method.void addSubscription(SubscriptionIterator iterator)
addSubscription(RecordSource)
void addSubscription(RecordSource source)
int res = 0;
do {
res = addSubscriptionPart
(source, res);
} while (res != 0);
All agents support mixed subscription. Subscription can be removed with this method
when marked with REMOVE_SYMBOL
flag.int addSubscriptionPart(RecordSource source, int notify)
All agents support mixed subscription. Subscription can be removed with this method
when marked with REMOVE_SYMBOL
flag.
source
- the subscription.notify
- result of previous method invocation or 0 on the first invocation.QDCollector.executeLockBoundTask(Executor, Runnable)
void removeSubscription(SubscriptionIterator iterator)
removeSubscription(RecordSource)
void removeSubscription(RecordSource source)
int res = 0;
do {
res = removeSubscriptionPart
(source, res);
} while (res != 0);
int removeSubscriptionPart(RecordSource source, int notify)
source
- the subscription.notify
- result of previous method invocation or 0 on the first invocation.QDCollector.executeLockBoundTask(Executor, Runnable)
void setSubscription(SubscriptionIterator iterator)
setSubscription(RecordSource)
void setSubscription(RecordSource source)
int res = 0;
do {
res = setSubscriptionPart
(source, res);
} while (res != 0);
int setSubscriptionPart(RecordSource source, int notify)
source
- the subscription.notify
- result of previous method invocation or 0 on the first invocation.QDCollector.executeLockBoundTask(Executor, Runnable)
void close()
QDCollector
.
Closed agent can not be activated again and shall not be used anymore.
Attempt to use closed agent will result in no action - subscription
will be ignored and data retrieval will retrieve no data.
This is a shortcut for a loop of
int res = 0;
do {
res = closePart
(res);
} while (res != 0);
int closePart(int notify)
QDCollector
.
This method facilitates a cooperative mechanism to execute tasks that spends most of their time under
the global lock of the collector.
Agents that started closing can not be activated again and shall not be used anymore. Attempt to use agent that had started closing result in no action - subscription will be ignored and data retrieval will retrieve no data.
notify
- result of previous method invocation or 0 on the first invocation.QDCollector.executeLockBoundTask(Executor, Runnable)
void closeAndExamineDataBySubscription(RecordSink sink)
close()
and atomically examines all data that is
available for this agent in the collector storage.close()
void setStreamOverflowStrategy(int max_buffer_size, boolean drop_oldest, boolean log_overflow)
setMaxBufferSize(int)
and setBufferOverflowStrategy(BufferOverflowStrategy)
max_buffer_size
- how many records to keep in buffer, default is 1000000drop_oldest
- which record shall be dropped - oldest (true) or newest (false), default is truelog_overflow
- whether overflow event shall be logged or not, default is true.
This value is ignored. Dropped events on overflow are always logged.IllegalArgumentException
- if max_buffer_size is not a positive integervoid setBufferOverflowStrategy(int max_buffer_size, boolean drop_oldest, boolean log_overflow)
setMaxBufferSize(int)
and setBufferOverflowStrategy(BufferOverflowStrategy)
max_buffer_size
- how many records to keep in buffer, default is 1000000drop_oldest
- which record shall be dropped - oldest (true) or newest (false), default is truelog_overflow
- whether overflow event shall be logged or not, default is true.
This value is ignored. Dropped events on overflow are always logged.IllegalArgumentException
- if max_buffer_size is not a positive integervoid setMaxBufferSize(int maxBufferSize)
maxBufferSize
- how many records to keep in buffer, default is 1000000IllegalArgumentException
- if maxBufferSize is not a positive integersetBufferOverflowStrategy(BufferOverflowStrategy)
void setBufferOverflowStrategy(QDAgent.BufferOverflowStrategy bufferOverflowStrategy)
bufferOverflowStrategy
- the strategy, default is QDAgent.BufferOverflowStrategy.DROP_OLDEST
.NullPointerException
- if bufferOverflowStrategy is null.setMaxBufferSize(int)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.