com.devexperts.qd
Interface QDAgent

All Superinterfaces:
DataProvider, QDStatsContainer, SubscriptionContainer
All Known Implementing Classes:
LoggedAgent

public interface QDAgent
extends DataProvider, SubscriptionContainer, QDStatsContainer

The 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.


Method Summary
 void addSubscription(SubscriptionIterator iterator)
          Adds specified subscription to this agent's data interest.
 void close()
          Closes this agent and releases allocated resources in its QDCollector.
 SubscriptionConsumer getAddingSubscriptionConsumer()
          Returns subscription consumer that can be used to add subscription.
 SubscriptionConsumer getRemovingSubscriptionConsumer()
          Returns subscription consumer that can be used to remove subscription.
 void removeSubscription(SubscriptionIterator iterator)
          Removes specified subscription from this agent's data interest.
 void setBufferOverflowStrategy(int max_buffer_size, boolean drop_oldest, boolean log_overflow)
          Sets new strategy for handling of stream and history buffer overflow events.
 void setStreamOverflowStrategy(int max_buffer_size, boolean drop_oldest, boolean log_overflow)
          Deprecated. Use setBufferOverflowStrategy(int, boolean, boolean)}
 void setSubscription(SubscriptionIterator iterator)
          Sets specified subscription to be this agent's data interest.
 
Methods inherited from interface com.devexperts.qd.DataProvider
retrieveData, setDataListener
 
Methods inherited from interface com.devexperts.qd.SubscriptionContainer
examineSubscription, getSubscriptionSize, isSubscribed
 
Methods inherited from interface com.devexperts.qd.stats.QDStatsContainer
getStats
 

Method Detail

getAddingSubscriptionConsumer

SubscriptionConsumer getAddingSubscriptionConsumer()
Returns subscription consumer that can be used to add subscription. Adding subscription via returned consumer has the same effect as adding it directly via addSubscription(com.devexperts.qd.SubscriptionIterator) method.


getRemovingSubscriptionConsumer

SubscriptionConsumer getRemovingSubscriptionConsumer()
Returns subscription consumer that can be used to remove subscription. Removing subscription via returned consumer has the same effect as removing it directly via removeSubscription(com.devexperts.qd.SubscriptionIterator) method.


addSubscription

void addSubscription(SubscriptionIterator iterator)
Adds specified subscription to this agent's data interest. This is a shortcut to adding subscription via corresponding subscription consumer.


removeSubscription

void removeSubscription(SubscriptionIterator iterator)
Removes specified subscription from this agent's data interest. This is a shortcut to removing subscription via corresponding subscription consumer.


setSubscription

void setSubscription(SubscriptionIterator iterator)
Sets specified subscription to be this agent's data interest. This method keeps state of survived subscription; in other words, it uses addAll+retainAll operations in contrast to removeAll+addAll operations.


close

void close()
Closes this agent and releases allocated resources in its 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.


setStreamOverflowStrategy

void setStreamOverflowStrategy(int max_buffer_size,
                               boolean drop_oldest,
                               boolean log_overflow)
Deprecated. Use setBufferOverflowStrategy(int, boolean, boolean)}

Sets new strategy for handling of stream and history buffer overflow events. New strategy settings apply only for newly distributed data. Their effect on already accumulated data is not defined. Has no effect on ticker agents.

Parameters:
max_buffer_size - how many records to keep in buffer, default is 1000000
drop_oldest - which record shall be dropped - oldest (true) or newest (false), default is true
log_overflow - whether overflow event shall be logged or not, default is true
Throws:
java.lang.IllegalArgumentException - if max_buffer_size is not a positive integer

setBufferOverflowStrategy

void setBufferOverflowStrategy(int max_buffer_size,
                               boolean drop_oldest,
                               boolean log_overflow)
Sets new strategy for handling of stream and history buffer overflow events. New strategy settings apply only for newly distributed data. Their effect on already accumulated data is not defined. Has no effect on ticker agents.

Parameters:
max_buffer_size - how many records to keep in buffer, default is 1000000
drop_oldest - which record shall be dropped - oldest (true) or newest (false), default is true
log_overflow - whether overflow event shall be logged or not, default is true
Throws:
java.lang.IllegalArgumentException - if max_buffer_size is not a positive integer