E- the type of events.
public class TimeSeriesEventModel<E extends TimeSeriesEvent<?>> extends IndexedEventModel<E>
TimeSeriesEventclass and arranges incoming events into a
listordered by their
The view of the current list of events is available via
Model change notifications are provided via
method of this list. It accepts an instance of
Users of this model only see the list of events in a consistent state. This model delays incoming events which
are part of incomplete snapshot or ongoing transaction until snapshot is complete or transaction has ended.
These pending events cannot be seen neither via list nor via listener calls, and so
eventFlags of events in the model are set to zero.
The eventFlags are only used and must be taken into account when processing time-series events directly via low-level
dxFeed API comes with a set of samples.
DXFeedCandleChart sample is a very simple UI application
that shows how to use this model with
Candle event to paint a simple candle chart, concentrating your
effort on data representation (painting) logic, while delegating all the data-handling logic to this model.
The convenient way to detach model from the feed is to call its
close method. Closed model
becomes permanently detached from all feeds, removes all its listeners and is guaranteed to be reclaimable by
the garbage collector as soon as all external references to it are cleared.
You must query the state of
attached model only from
inside of the notification invocations or from within the thread that performs
ObservableListModelListener instances are invoked from a separate thread via the executor.
Default executor for all models is configured with
method. Each model can individually override its executor with
method. The corresponding
notification is guaranteed to never be concurrent, even though it may happen from different
threads if executor is multi-threaded.
In practice, it means that is UI applications you must
install UI-thread-bound execution to your
DXEndpoint.executor method, so that you
can freely use all methods of this model from UI thread.
Custom executor can be used by backend applications that do not need to immediately update this model on
arrival of new events, but want to update the model at a later time, for example, from inside of a servlet request.
This approach is explained with code samples in
Threads and locks
DXFeedSubscription class documentation.
|Constructor and Description|
Creates new model.
|Modifier and Type||Method and Description|
Returns the time from which to subscribe for time-series, or
Returns model subscription symbol, or
Changes the time from which to subscribe for time-series, use
Changes symbol for this model to subscribe for.
close, createEntry, getEventsList, modelChanged
attach, detach, entryListIterator, get, getExecutor, getSizeLimit, isClosed, isSnapshotEnd, listIterator, listIterator, setExecutor, setSizeLimit, size
setSymbol(java.lang.Object)to specify subscription symbol,
setFromTime(long)to specify subscription time, and
AbstractIndexedEventModel.attach(com.dxfeed.api.DXFeed)method to specify feed to start receiving events.
eventType- the event type.
NullPointerException- if event type is null.
public void clear()
Long.MAX_VALUE, subsequently, all events in this model are cleared.
public Object getSymbol()
nullis not subscribed (this is a default value).
public void setSymbol(Object symbol)
public long getFromTime()
Long.MAX_VALUEis not subscribed (this is a default value).
Copyright © 2002-2020 Devexperts LLC. All Rights Reserved.