public class DataRowStore extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_BRIDGE_FACTORY_DEFAULT |
static String |
EVENT_BRIDGE_FACTORY_PROPERTY |
protected EventManager |
eventManager |
protected EventSubject |
eventSubject |
protected String |
name |
protected boolean |
notifyingRemoteListeners |
static boolean |
REMOTE_NOTIFICATION_DEFAULT |
static String |
REMOTE_NOTIFICATION_PROPERTY |
protected EventBridge |
remoteNotificationsHandler |
static int |
SNAPSHOT_CACHE_SIZE_DEFAULT |
static String |
SNAPSHOT_CACHE_SIZE_PROPERTY |
static long |
SNAPSHOT_EXPIRATION_DEFAULT |
static String |
SNAPSHOT_EXPIRATION_PROPERTY |
protected ConcurrentMap<ObjectId,DataRow> |
snapshots |
Constructor and Description |
---|
DataRowStore(String name,
Map properties,
EventManager eventManager)
Creates new DataRowStore with a specified name and a set of properties.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Expires and removes all stored snapshots without sending any notification events.
|
void |
forgetSnapshot(ObjectId id)
Evicts a snapshot from cache without generating any SnapshotEvents.
|
DataRow |
getCachedSnapshot(ObjectId oid)
Returns cached snapshot or null if no snapshot is currently cached for the given
ObjectId.
|
EventManager |
getEventManager()
Returns an EventManager associated with this DataRowStore.
|
String |
getName()
Returns the name of this DataRowStore.
|
EventSubject |
getSnapshotEventSubject()
Returns EventSubject used by this SnapshotCache to notify of snapshot changes.
|
protected void |
initWithProperties(Map properties) |
boolean |
isNotifyingRemoteListeners() |
int |
maximumSize()
Returns maximum allowed cache size.
|
void |
processRemoteEvent(SnapshotEvent event)
Handles remote events received via EventBridge.
|
void |
processSnapshotChanges(Object postedBy,
Map updatedSnapshots,
Collection deletedSnapshotIds,
Collection invalidatedSnapshotIds,
Collection indirectlyModifiedIds)
Processes changes made to snapshots.
|
void |
setEventManager(EventManager eventManager)
Sets an EventManager associated with this DataRowStore.
|
void |
setName(String name)
Sets the name of this DataRowStore.
|
void |
setNotifyingRemoteListeners(boolean notifyingRemoteListeners) |
void |
shutdown()
Shuts down any remote notification connections, and clears internal cache.
|
int |
size()
Returns current cache size.
|
public static final String SNAPSHOT_EXPIRATION_PROPERTY
public static final String SNAPSHOT_CACHE_SIZE_PROPERTY
public static final String REMOTE_NOTIFICATION_PROPERTY
public static final String EVENT_BRIDGE_FACTORY_PROPERTY
public static final long SNAPSHOT_EXPIRATION_DEFAULT
public static final int SNAPSHOT_CACHE_SIZE_DEFAULT
public static final boolean REMOTE_NOTIFICATION_DEFAULT
public static final String EVENT_BRIDGE_FACTORY_DEFAULT
protected String name
protected ConcurrentMap<ObjectId,DataRow> snapshots
protected boolean notifyingRemoteListeners
protected transient EventManager eventManager
protected transient EventBridge remoteNotificationsHandler
protected transient EventSubject eventSubject
public DataRowStore(String name, Map properties, EventManager eventManager)
name
- DataRowStore name. Used to idenitfy 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.protected void initWithProperties(Map properties)
public int size()
public int maximumSize()
public void shutdown()
public String getName()
public void setName(String name)
public EventManager getEventManager()
public void setEventManager(EventManager eventManager)
public DataRow getCachedSnapshot(ObjectId oid)
public EventSubject getSnapshotEventSubject()
public void clear()
public void forgetSnapshot(ObjectId id)
public void processRemoteEvent(SnapshotEvent event)
public void processSnapshotChanges(Object postedBy, Map updatedSnapshots, Collection deletedSnapshotIds, Collection invalidatedSnapshotIds, Collection indirectlyModifiedIds)
public boolean isNotifyingRemoteListeners()
public void setNotifyingRemoteListeners(boolean notifyingRemoteListeners)
Copyright © 2001–2015 Apache Cayenne. All rights reserved.