Package org.nuxeo.ecm.core.storage.sql
Class SelectionContext
java.lang.Object
org.nuxeo.ecm.core.storage.sql.SelectionContext
A
SelectionContext
holds information for a set Selection
objects, mostly acting as a cache.
Some of the information is identical to what's in the database and can be safely be GC'ed, so it lives in a memory-sensitive map (softMap), otherwise it's moved to a normal map (hardMap) (creation or deletion).
-
Field Summary
Modifier and TypeFieldDescriptionprotected final io.dropwizard.metrics5.Timer
protected final io.dropwizard.metrics5.Counter
final Map<Serializable,
Selection> protected final io.dropwizard.metrics5.Counter
protected final io.dropwizard.metrics5.MetricRegistry
-
Constructor Summary
ConstructorDescriptionSelectionContext
(SelectionType selType, Serializable criterion, RowMapper mapper, PersistenceContext context) -
Method Summary
Modifier and TypeMethodDescriptionboolean
applicable
(SimpleFragment fragment) int
void
gatherInvalidations
(VCSInvalidations invalidations) Gathers invalidations from this session.getSelectionFragment
(Serializable selId, String filter) Find a fragment given its selection id and value.getSelectionFragments
(Serializable selId, String filter) Finds all the selection fragments for a given id.getSelectionIds
(List<Serializable> values) Gets all the selection fragment ids for a given list of values.protected Selection
getSelectionOrNull
(Serializable selId) Gets the proper selection cache, if it exists, otherwise returnsnull
.int
getSize()
void
markInvalidated
(Set<RowId> modified) Marks locally all the invalidations gathered by aMapper
operation (like a version restore).void
newSelection
(Serializable selId) Notes that a new empty selection should be created.void
postSave()
void
processReceivedInvalidations
(Set<RowId> modified) Processes all invalidations accumulated.void
recordCreated
(SimpleFragment fragment) Records the fragment as a just-created selection member.void
recordExisting
(SimpleFragment fragment, boolean invalidate) void
recordRemoved
(Serializable id, Serializable selId) Removes a selection item from the selection.void
recordRemoved
(SimpleFragment fragment) Removes a selection item from the selection.void
Records a selection as removed.
-
Field Details
-
hardMap
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry -
modifiedInTransactionCount
protected final io.dropwizard.metrics5.Counter modifiedInTransactionCount -
cacheHitCount
protected final io.dropwizard.metrics5.Counter cacheHitCount -
cacheGetTimer
protected final io.dropwizard.metrics5.Timer cacheGetTimer
-
-
Constructor Details
-
SelectionContext
public SelectionContext(SelectionType selType, Serializable criterion, RowMapper mapper, PersistenceContext context)
-
-
Method Details
-
clearCaches
public int clearCaches() -
getSize
public int getSize() -
getSelectionOrNull
Gets the proper selection cache, if it exists, otherwise returnsnull
.- Since:
- 9.2
-
applicable
-
recordCreated
Records the fragment as a just-created selection member. -
newSelection
Notes that a new empty selection should be created. -
recordExisting
- Parameters:
invalidate
-true
if this is for a fragment newly created by internal database process (copy, etc.) and must notified to other session;false
if this is a normal read
-
recordRemoved
Removes a selection item from the selection. -
recordRemoved
Removes a selection item from the selection. -
recordRemovedSelection
Records a selection as removed. -
getSelectionFragment
Find a fragment given its selection id and value.If the fragment is not in the context, fetch it from the mapper.
- Parameters:
selId
- the selection idfilter
- the value to filter on- Returns:
- the fragment, or
null
if not found
-
getSelectionFragments
Finds all the selection fragments for a given id.No sorting on value is done.
- Parameters:
selId
- the selection idfilter
- the value to filter on, ornull
for all- Returns:
- the list of fragments
-
getSelectionIds
Gets all the selection fragment ids for a given list of values.- Since:
- 9.2
-
postSave
public void postSave() -
markInvalidated
Marks locally all the invalidations gathered by aMapper
operation (like a version restore). -
gatherInvalidations
Gathers invalidations from this session.Called post-transaction to gathers invalidations to be sent to others.
-
processReceivedInvalidations
Processes all invalidations accumulated.Called pre-transaction.
-