public class PVCacheImpl extends Object implements PVCache, DataStorageListener
PVCache
first implementation. Handles the communication between a
list of sources, a storage and registered queries threw
PVCacheListener
. Manages a list of requested intervals which are
intersected with new requested TimeInterval
. Manages a list a
completed intervals which is the result of the concatenation of the lists of
completed intervals per sources. When data is lost from storage, the
IntervalsList
generated from the TimestampsSet
is subtracted
to all requested/completed intervals lists.Constructor and Description |
---|
PVCacheImpl(String channelName,
Collection<DataSource> dataSources,
DataStorage storage) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(PVCacheListener listener)
Add a
PVCacheListener to be notified when new samples are
available. |
void |
dataLoss(TimestampsSet lostSet)
Informs that the specified set of
Timestamp have been removed
from storage. |
String |
getChannelName() |
IntervalsList |
getCompletedIntervalsList()
Get the completed intervals list.
|
PVCacheStatistics |
getStatistics() |
boolean |
isProcessingSources() |
boolean |
isStatisticsEnabled() |
void |
removeListener(PVCacheListener listener)
Remove a
PVCacheListener . |
DataRequestThread |
retrieveDataAsync(org.epics.util.time.TimeInterval interval)
Asynchronously retrieves samples from sources for the requested
TimeInterval and asynchronously requests DataStorage for
immediately available samples. |
SortedSet<Data> |
retrieveDataSync(org.epics.util.time.TimeInterval interval)
Synchronously requests
DataStorage for immediately available
samples. |
void |
setStatisticsEnabled(boolean enabled) |
void |
startLiveDataProcessing()
Start processing live data samples.
|
void |
stopLiveDataProcessing()
Stop processing live data samples.
|
public PVCacheImpl(String channelName, Collection<DataSource> dataSources, DataStorage storage)
public void startLiveDataProcessing()
startLiveDataProcessing
in interface PVCache
public void stopLiveDataProcessing()
stopLiveDataProcessing
in interface PVCache
public void addListener(PVCacheListener listener)
PVCacheListener
to be notified when new samples are
available.addListener
in interface PVCache
listener
- to be addedpublic void removeListener(PVCacheListener listener)
PVCacheListener
.removeListener
in interface PVCache
listener
- to be removedpublic DataRequestThread retrieveDataAsync(org.epics.util.time.TimeInterval interval)
TimeInterval
and asynchronously requests DataStorage
for
immediately available samples.retrieveDataAsync
in interface PVCache
interval
- TimeInterval
to be retrieved.public SortedSet<Data> retrieveDataSync(org.epics.util.time.TimeInterval interval)
DataStorage
for immediately available
samples.retrieveDataSync
in interface PVCache
interval
- TimeInterval
to be retrieved.public void dataLoss(TimestampsSet lostSet)
Timestamp
have been removed
from storage.dataLoss
in interface DataStorageListener
lostSet
- TimestampsSet
of lost Timestamp
.public IntervalsList getCompletedIntervalsList()
TimeInterval
is completed
when all DataSource
have finished responding.getCompletedIntervalsList
in interface PVCache
IntervalsList
the list of completed intervals.public void setStatisticsEnabled(boolean enabled)
setStatisticsEnabled
in interface PVCache
public boolean isStatisticsEnabled()
isStatisticsEnabled
in interface PVCache
public PVCacheStatistics getStatistics()
getStatistics
in interface PVCache
public boolean isProcessingSources()
public String getChannelName()
Copyright © 2010–2015. All rights reserved.