com.dxfeed.api.impl
Class DXFeedImpl

java.lang.Object
  extended by com.dxfeed.api.DXFeed
      extended by com.dxfeed.api.impl.DXFeedImpl

public class DXFeedImpl
extends DXFeed


Constructor Summary
DXFeedImpl(java.util.concurrent.Executor executor, com.devexperts.qd.QDCollector... collectors)
           
 
Method Summary
 void attachSubscription(DXFeedSubscription subscription)
          Attaches the given subscription to this feed.
 void connect(java.lang.String address)
           
 void detachSubscription(DXFeedSubscription subscription)
          Detaches the given subscription from this feed.
<T extends Event>
T
getLastEvent(T event)
          Returns the last event for the specified symbol and event type.
 
Methods inherited from class com.dxfeed.api.DXFeed
createConnectedFeed, createSubscription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DXFeedImpl

public DXFeedImpl(java.util.concurrent.Executor executor,
                  com.devexperts.qd.QDCollector... collectors)
Method Detail

connect

public void connect(java.lang.String address)

attachSubscription

public void attachSubscription(DXFeedSubscription subscription)
Description copied from class: DXFeed
Attaches the given subscription to this feed. This method does nothing if the corresponding subscription is already attached to this feed.

This method adds a non-serializable class as a DXFeedSubscriptionChangeListener for the given subscription via DXFeedSubscription.addSubscriptionChangeListener(com.dxfeed.api.DXFeedSubscriptionChangeListener) method. Attachment is lost when subscription is serialized.

Specified by:
attachSubscription in class DXFeed
Parameters:
subscription - the subscription.
See Also:
DXFeedSubscription

detachSubscription

public void detachSubscription(DXFeedSubscription subscription)
Description copied from class: DXFeed
Detaches the given subscription from this feed. This method does nothing if the corresponding subscription is not attached to this feed.

This method removes a class as a DXFeedSubscriptionChangeListener for the given subscription via DXFeedSubscription.removeSubscriptionChangeListener(com.dxfeed.api.DXFeedSubscriptionChangeListener) method.

Specified by:
detachSubscription in class DXFeed
Parameters:
subscription - the subscription.
See Also:
DXFeedSubscription

getLastEvent

public <T extends Event> T getLastEvent(T event)
Description copied from class: DXFeed
Returns the last event for the specified symbol and event type. This method goes not make any remote calls to the uplink data provider. It just retrieves last received event from the local cache of this feed. The events are stored in the cache only if there is some attached DXFeedSubscription that is subscribed to the corresponding symbol and event type.

This method fills in the values for the last event into the event argument. If the last event is not avilable for any reason (no subscription, no connection to uplink, not applicable to this event type, etc), then the event object is not changed. This method always returns the same event that is passed to it as an argument.

Specified by:
getLastEvent in class DXFeed
Type Parameters:
T - the event type.
Parameters:
event - the event.
Returns:
the event.