public abstract class BaseCollectionStatsStorage extends java.lang.Object implements StatsStorage
StatsStorage
interface, backed by MapDBModifier and Type | Class and Description |
---|---|
static class |
BaseCollectionStatsStorage.SessionTypeId |
static class |
BaseCollectionStatsStorage.SessionTypeWorkerId |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<StatsStorageListener> |
listeners |
protected java.util.Set<java.lang.String> |
sessionIDs |
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Persistable> |
staticInfo |
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeId,StorageMetaData> |
storageMetaData |
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeWorkerId,java.util.Map<java.lang.Long,Persistable>> |
updates |
Modifier | Constructor and Description |
---|---|
protected |
BaseCollectionStatsStorage() |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<StatsStorageEvent> |
checkStorageEvents(Persistable p) |
void |
deregisterStatsStorageListener(StatsStorageListener listener)
Remove the specified listener, if it is present.
|
java.util.List<Persistable> |
getAllStaticInfos(java.lang.String sessionID,
java.lang.String typeID)
Get all static informations for the given session and type ID
|
java.util.List<Persistable> |
getAllUpdatesAfter(java.lang.String sessionID,
java.lang.String typeID,
long timestamp)
Get all updates for the given session ID (all worker IDs), that occur after (not including) the given timestamp.
|
java.util.List<Persistable> |
getAllUpdatesAfter(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID,
long timestamp)
Get all updates for the given session and worker ID, that occur after (not including) the given timestamp.
|
Persistable |
getLatestUpdate(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID)
Get the latest update record (i.e., update record with the largest timestamp value) for the specified
session and worker IDs
|
java.util.List<Persistable> |
getLatestUpdateAllWorkers(java.lang.String sessionID,
java.lang.String typeID)
Get the latest update for all workers, for the given session ID
|
java.util.List<StatsStorageListener> |
getListeners()
Get a list (shallow copy) of all listeners currently present
|
int |
getNumUpdateRecordsFor(java.lang.String sessionID)
Return the number of update records for the given session ID (all workers)
|
int |
getNumUpdateRecordsFor(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID)
Return the number of update records for the given session ID and worker ID
|
Persistable |
getStaticInfo(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID)
Get the static info for the given session and worker IDs, or null if no such static info has been reported
|
StorageMetaData |
getStorageMetaData(java.lang.String sessionID,
java.lang.String typeID)
Get the session metadata, if any has been registered via
StatsStorageRouter.putStorageMetaData(StorageMetaData) |
Persistable |
getUpdate(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID,
long timestamp)
Get the specified update (or null, if none exists for the given session/worker ids and timestamp)
|
protected abstract java.util.Map<java.lang.Long,Persistable> |
getUpdateMap(java.lang.String sessionID,
java.lang.String typeID,
java.lang.String workerID,
boolean createIfRequired) |
java.util.List<java.lang.String> |
listSessionIDs()
Get a list of all sessions stored by this storage backend
|
java.util.List<java.lang.String> |
listTypeIDsForSession(java.lang.String sessionID)
Get the list of type IDs for the given session ID
|
java.util.List<java.lang.String> |
listWorkerIDsForSession(java.lang.String sessionID)
For a given session ID, list all of the known worker IDs
|
java.util.List<java.lang.String> |
listWorkerIDsForSessionAndType(java.lang.String sessionID,
java.lang.String typeID)
For a given session ID and type ID, list all of the known worker IDs
|
protected void |
notifyListeners(java.util.List<StatsStorageEvent> sses) |
void |
putStaticInfo(java.util.Collection<? extends Persistable> staticInfo)
Static info: reported once per session, upon initialization
|
abstract void |
putStaticInfo(Persistable staticInfo)
Static info: reported once per session, upon initialization
|
void |
putStorageMetaData(java.util.Collection<? extends StorageMetaData> storageMetaData) |
abstract void |
putStorageMetaData(StorageMetaData storageMetaData)
Method to store some additional metadata for each session.
|
void |
putUpdate(java.util.Collection<? extends Persistable> updates)
Updates: stored multiple times per session (periodically, for example)
|
abstract void |
putUpdate(Persistable update)
Updates: stored multiple times per session (periodically, for example)
|
void |
registerStatsStorageListener(StatsStorageListener listener)
Add a new StatsStorageListener.
|
void |
removeAllListeners()
Remove all listeners from the StatsStorage instance
|
boolean |
sessionExists(java.lang.String sessionID)
Check if the specified session ID exists or not
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isClosed
protected java.util.Set<java.lang.String> sessionIDs
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeId,StorageMetaData> storageMetaData
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Persistable> staticInfo
protected java.util.Map<BaseCollectionStatsStorage.SessionTypeWorkerId,java.util.Map<java.lang.Long,Persistable>> updates
protected java.util.List<StatsStorageListener> listeners
protected abstract java.util.Map<java.lang.Long,Persistable> getUpdateMap(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID, boolean createIfRequired)
protected java.util.List<StatsStorageEvent> checkStorageEvents(Persistable p)
protected void notifyListeners(java.util.List<StatsStorageEvent> sses)
public java.util.List<java.lang.String> listSessionIDs()
StatsStorage
listSessionIDs
in interface StatsStorage
public boolean sessionExists(java.lang.String sessionID)
StatsStorage
sessionExists
in interface StatsStorage
sessionID
- Session ID to checkpublic Persistable getStaticInfo(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID)
StatsStorage
getStaticInfo
in interface StatsStorage
sessionID
- Session IDworkerID
- worker IDpublic java.util.List<Persistable> getAllStaticInfos(java.lang.String sessionID, java.lang.String typeID)
StatsStorage
getAllStaticInfos
in interface StatsStorage
sessionID
- Session ID to get static info fortypeID
- Type ID to get static info forpublic java.util.List<java.lang.String> listTypeIDsForSession(java.lang.String sessionID)
StatsStorage
listTypeIDsForSession
in interface StatsStorage
sessionID
- Session ID to querypublic java.util.List<java.lang.String> listWorkerIDsForSession(java.lang.String sessionID)
StatsStorage
listWorkerIDsForSession
in interface StatsStorage
sessionID
- Session IDpublic java.util.List<java.lang.String> listWorkerIDsForSessionAndType(java.lang.String sessionID, java.lang.String typeID)
StatsStorage
listWorkerIDsForSessionAndType
in interface StatsStorage
sessionID
- Session IDtypeID
- Type IDpublic int getNumUpdateRecordsFor(java.lang.String sessionID)
StatsStorage
getNumUpdateRecordsFor
in interface StatsStorage
sessionID
- Session IDpublic int getNumUpdateRecordsFor(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID)
StatsStorage
getNumUpdateRecordsFor
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker IDpublic Persistable getLatestUpdate(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID)
StatsStorage
getLatestUpdate
in interface StatsStorage
sessionID
- session IDworkerID
- worker IDpublic Persistable getUpdate(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID, long timestamp)
StatsStorage
getUpdate
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker IDtimestamp
- Timestamppublic java.util.List<Persistable> getLatestUpdateAllWorkers(java.lang.String sessionID, java.lang.String typeID)
StatsStorage
getLatestUpdateAllWorkers
in interface StatsStorage
sessionID
- Session IDpublic java.util.List<Persistable> getAllUpdatesAfter(java.lang.String sessionID, java.lang.String typeID, java.lang.String workerID, long timestamp)
StatsStorage
getAllUpdatesAfter
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker Idtimestamp
- Timestamppublic java.util.List<Persistable> getAllUpdatesAfter(java.lang.String sessionID, java.lang.String typeID, long timestamp)
StatsStorage
getAllUpdatesAfter
in interface StatsStorage
sessionID
- Session IDtimestamp
- Timestamppublic StorageMetaData getStorageMetaData(java.lang.String sessionID, java.lang.String typeID)
StatsStorage
StatsStorageRouter.putStorageMetaData(StorageMetaData)
getStorageMetaData
in interface StatsStorage
sessionID
- Session ID to get metadatpublic abstract void putStaticInfo(Persistable staticInfo)
StatsStorageRouter
putStaticInfo
in interface StatsStorageRouter
staticInfo
- Static info to storepublic void putStaticInfo(java.util.Collection<? extends Persistable> staticInfo)
StatsStorageRouter
putStaticInfo
in interface StatsStorageRouter
staticInfo
- Static info to storepublic abstract void putUpdate(Persistable update)
StatsStorageRouter
putUpdate
in interface StatsStorageRouter
update
- Update info to storepublic void putUpdate(java.util.Collection<? extends Persistable> updates)
StatsStorageRouter
putUpdate
in interface StatsStorageRouter
updates
- Update info to storepublic abstract void putStorageMetaData(StorageMetaData storageMetaData)
StatsStorageRouter
putStorageMetaData
in interface StatsStorageRouter
storageMetaData
- Storage metadata to storepublic void putStorageMetaData(java.util.Collection<? extends StorageMetaData> storageMetaData)
putStorageMetaData
in interface StatsStorageRouter
public void registerStatsStorageListener(StatsStorageListener listener)
StatsStorage
registerStatsStorageListener
in interface StatsStorage
listener
- Listener to addpublic void deregisterStatsStorageListener(StatsStorageListener listener)
StatsStorage
deregisterStatsStorageListener
in interface StatsStorage
listener
- Listener to removepublic void removeAllListeners()
StatsStorage
removeAllListeners
in interface StatsStorage
public java.util.List<StatsStorageListener> getListeners()
StatsStorage
getListeners
in interface StatsStorage