com.devexperts.qd.logger
Class LoggedCollector

java.lang.Object
  extended by com.devexperts.qd.logger.LoggedObject
      extended by com.devexperts.qd.logger.LoggedCollector
All Implemented Interfaces:
QDCollector, QDStatsContainer, SubscriptionContainer
Direct Known Subclasses:
LoggedHistory, LoggedStream, LoggedTicker

public class LoggedCollector
extends LoggedObject
implements QDCollector


Field Summary
 
Fields inherited from class com.devexperts.qd.logger.LoggedObject
log, name
 
Constructor Summary
LoggedCollector(QDLog log, java.lang.String name, QDCollector delegate)
           
 
Method Summary
 QDAgent createAgent(SubscriptionFilter filter)
          Creates new agent with specified subscription filter.
 QDAgent createAgent(SubscriptionFilter filter, java.lang.String key_properties)
           
 QDDistributor createDistributor(SubscriptionFilter filter)
          Creates new distributor with specified subscription filter.
 QDDistributor createDistributor(SubscriptionFilter filter, java.lang.String key_properties)
           
 boolean examineSubscription(SubscriptionVisitor visitor)
          Examines subscription and passes it to the visitor.
 QDContract getContract()
          Retruns contract that this collector provides.
 DataScheme getScheme()
          Returns data scheme used by this QD component.
 QDStats getStats()
           
 int getSubscriptionSize()
          Returns subscription size in terms of (record, symbol) pairs.
 java.lang.String getSymbol(char[] chars, int offset, int length)
           
 boolean isSubscribed(DataRecord record, int cipher, java.lang.String symbol, long time)
          Returns true if subscribed to the corresponding record and symbol with the corresponding time.
 void setErrorHandler(QDErrorHandler error_handler)
          Sets errors handler for all errors that are happening during notification of agents and distributors.
 
Methods inherited from class com.devexperts.qd.logger.LoggedObject
child, debug, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoggedCollector

public LoggedCollector(QDLog log,
                       java.lang.String name,
                       QDCollector delegate)
Method Detail

getScheme

public DataScheme getScheme()
Description copied from interface: QDCollector
Returns data scheme used by this QD component.

Specified by:
getScheme in interface QDCollector

getContract

public QDContract getContract()
Description copied from interface: QDCollector
Retruns contract that this collector provides.

Specified by:
getContract in interface QDCollector

createAgent

public QDAgent createAgent(SubscriptionFilter filter)
Description copied from interface: QDCollector
Creates new agent with specified subscription filter. Specify null to use no filter.

Specified by:
createAgent in interface QDCollector

createAgent

public QDAgent createAgent(SubscriptionFilter filter,
                           java.lang.String key_properties)
Specified by:
createAgent in interface QDCollector

createDistributor

public QDDistributor createDistributor(SubscriptionFilter filter)
Description copied from interface: QDCollector
Creates new distributor with specified subscription filter. Specify null to use no filter.

Specified by:
createDistributor in interface QDCollector

createDistributor

public QDDistributor createDistributor(SubscriptionFilter filter,
                                       java.lang.String key_properties)
Specified by:
createDistributor in interface QDCollector

getStats

public QDStats getStats()
Specified by:
getStats in interface QDStatsContainer

isSubscribed

public boolean isSubscribed(DataRecord record,
                            int cipher,
                            java.lang.String symbol,
                            long time)
Description copied from interface: SubscriptionContainer
Returns true if subscribed to the corresponding record and symbol with the corresponding time. Non-historic (stream and ticker) QD ignores time parameter.

Note: Check by time in history is not guaranteed yet (may transiently give wrong result), because it performs unsynchronized read on two ints to get time from internal data structure. In history it is guaranteed to work properly only when time parameter is set to Long.MAX_VALUE.

Specified by:
isSubscribed in interface SubscriptionContainer

examineSubscription

public boolean examineSubscription(SubscriptionVisitor visitor)
Description copied from interface: SubscriptionContainer
Examines subscription and passes it to the visitor. Returns true if not all subscription was examined or false otherwise.

Note: Visited subscription time in history is not guaranteed yet (may transiently give wrong result), because it performs unsynchronized read on two ints to get time from internal data structure.

Specified by:
examineSubscription in interface SubscriptionContainer

getSubscriptionSize

public int getSubscriptionSize()
Description copied from interface: SubscriptionContainer
Returns subscription size in terms of (record, symbol) pairs.

Specified by:
getSubscriptionSize in interface SubscriptionContainer

setErrorHandler

public void setErrorHandler(QDErrorHandler error_handler)
Description copied from interface: QDCollector
Sets errors handler for all errors that are happening during notification of agents and distributors. Default error handler for collector is intialized via DataScheme.getService(java.lang.Class) method and QDErrorHandler.DEFAULT is used if no override is found.

Specified by:
setErrorHandler in interface QDCollector

getSymbol

public java.lang.String getSymbol(char[] chars,
                                  int offset,
                                  int length)
Specified by:
getSymbol in interface QDCollector