Package org.apache.cayenne.access
Class DataRowStore
java.lang.Object
org.apache.cayenne.access.DataRowStore
- All Implemented Interfaces:
- Serializable
public class DataRowStore extends Object implements Serializable
A fixed size cache of DataRows keyed by ObjectId.
- Since:
- 1.1
- See Also:
- Serialized Form
- 
Field SummaryFields Modifier and Type Field Description protected EventManagereventManagerprotected EventSubjecteventSubjectprotected Stringnameprotected EventBridgeremoteNotificationsHandlerstatic intSNAPSHOT_CACHE_SIZE_DEFAULTstatic longSNAPSHOT_EXPIRATION_DEFAULTprotected ConcurrentMap<ObjectId,DataRow>snapshots
- 
Constructor SummaryConstructors Constructor Description DataRowStore(String name, RuntimeProperties properties, EventManager eventManager)Creates new DataRowStore with a specified name and a set of properties.
- 
Method SummaryModifier and Type Method Description voidclear()Expires and removes all stored snapshots without sending any notification events.voidforgetSnapshot(ObjectId id)Evicts a snapshot from cache without generating any SnapshotEvents.DataRowgetCachedSnapshot(ObjectId oid)Returns cached snapshot or null if no snapshot is currently cached for the given ObjectId.protected EventBridgegetEventBridge()EventManagergetEventManager()Returns an EventManager associated with this DataRowStore.StringgetName()Returns the name of this DataRowStore.EventSubjectgetSnapshotEventSubject()Returns EventSubject used by this SnapshotCache to notify of snapshot changes.protected voidinitWithProperties(RuntimeProperties properties)intmaximumSize()Returns maximum allowed cache size.voidprocessRemoteEvent(SnapshotEvent event)Handles remote events received via EventBridge.voidprocessSnapshotChanges(Object postedBy, Map<ObjectId,DataRow> updatedSnapshots, Collection<ObjectId> deletedSnapshotIds, Collection<ObjectId> invalidatedSnapshotIds, Collection<ObjectId> indirectlyModifiedIds)Processes changes made to snapshots.protected voidsetEventBridge(EventBridge eventBridge)voidsetEventManager(EventManager eventManager)Sets an EventManager associated with this DataRowStore.voidsetName(String name)Sets the name of this DataRowStore.voidshutdown()Shuts down any remote notification connections, and clears internal cache.intsize()Returns current cache size.
- 
Field Details- 
SNAPSHOT_EXPIRATION_DEFAULTpublic static final long SNAPSHOT_EXPIRATION_DEFAULT- See Also:
- Constant Field Values
 
- 
SNAPSHOT_CACHE_SIZE_DEFAULTpublic static final int SNAPSHOT_CACHE_SIZE_DEFAULT- See Also:
- Constant Field Values
 
- 
name
- 
snapshots
- 
eventManager
- 
remoteNotificationsHandler
- 
eventSubject
 
- 
- 
Constructor Details- 
DataRowStoreCreates new DataRowStore with a specified name and a set of properties. If no properties are defined, default values are used.- Parameters:
- name- DataRowStore name. Used to identify this DataRowStore in events, etc. Can't be null.
- properties- Properties map used to configure DataRowStore parameters. Can be null.
- eventManager- EventManager that should be used for posting and receiving events.
- Since:
- 1.2
 
 
- 
- 
Method Details- 
initWithProperties
- 
setEventBridge
- 
getEventBridge
- 
sizepublic int size()Returns current cache size.
- 
maximumSizepublic int maximumSize()Returns maximum allowed cache size.
- 
shutdownpublic void shutdown()Shuts down any remote notification connections, and clears internal cache.
- 
getNameReturns the name of this DataRowStore. Name allows to create EventSubjects for event notifications addressed to or sent from this DataRowStore.
- 
setNameSets the name of this DataRowStore. Name allows to create EventSubjects for event notifications addressed to or sent from this DataRowStore.
- 
getEventManagerReturns an EventManager associated with this DataRowStore.- Since:
- 1.2
 
- 
setEventManagerSets an EventManager associated with this DataRowStore.- Since:
- 1.2
 
- 
getCachedSnapshotReturns cached snapshot or null if no snapshot is currently cached for the given ObjectId.
- 
getSnapshotEventSubjectReturns EventSubject used by this SnapshotCache to notify of snapshot changes.
- 
clearpublic void clear()Expires and removes all stored snapshots without sending any notification events.
- 
forgetSnapshotEvicts a snapshot from cache without generating any SnapshotEvents.
- 
processRemoteEventHandles remote events received via EventBridge. Performs needed snapshot updates, and then resends the event to local listeners.
- 
processSnapshotChangespublic void processSnapshotChanges(Object postedBy, Map<ObjectId,DataRow> updatedSnapshots, Collection<ObjectId> deletedSnapshotIds, Collection<ObjectId> invalidatedSnapshotIds, Collection<ObjectId> indirectlyModifiedIds)Processes changes made to snapshots. Modifies internal cache state, and then sends the event to all listeners. Source of these changes is usually an ObjectStore.
 
-