Package org.nuxeo.ecm.core.storage.sql
Class SoftRefCachingRowMapper
java.lang.Object
org.nuxeo.ecm.core.storage.sql.SoftRefCachingRowMapper
- All Implemented Interfaces:
RowMapper
- Direct Known Subclasses:
SoftRefCachingMapper
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.storage.sql.RowMapper
RowMapper.CopyResult, RowMapper.IdWithTypes, RowMapper.NodeInfo, RowMapper.RowBatch, RowMapper.RowUpdate -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.dropwizard.metrics5.Timerprotected io.dropwizard.metrics5.Counterfinal VCSInvalidationsQueueThe queue of cache invalidations received from other session, to process at pre-transaction time.protected final io.dropwizard.metrics5.MetricRegistryCache statisticsprotected io.dropwizard.metrics5.Timerprotected io.dropwizard.metrics5.Counter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Rowprotected voidprotected voidcachePutAbsent(RowId rowId) protected voidcachePutAbsentIfNull(RowId rowId, Row row) protected voidcachePutAbsentIfRowId(RowId rowId) protected voidcacheRemove(RowId rowId) voidClears the mapper's cache (if any)voidclose()copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren, boolean excludeACL) Copies the hierarchy starting from a given row to a new parent with a new name.Computes a new unique id.getBinaryFulltext(RowId rowId) Gets the fulltext extracted from the binary fields.longEvaluate the cached elements sizegetDescendantsInfo(Serializable rootId) Gets descendants infos from a given root node.voidinitialize(String repositoryName, Model model, RowMapper rowMapper, VCSInvalidationsPropagator cachePropagator, Map<String, String> properties) protected static booleanread(Collection<RowId> rowIds, boolean cacheOnly) Reads a set of rows for the givenRowIds.readCollectionRowArray(RowId rowId) Gets an array for aCollectionFragmentfrom the database, given its table name and id.readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne) Reads the rows corresponding to a selection.readSelectionsIds(SelectionType selType, List<Serializable> values) Gets all the selection ids for a given list of values.readSimpleRow(RowId rowId) Gets a row for aSimpleFragmentfrom the database, given its table name and id.Processes and returns the invalidations queued for processing by the cache (if any).voidremove(Serializable rootId, List<RowMapper.NodeInfo> nodeInfos) Deletes a hierarchy.voidrollback()Rollback the transaction.voidsendInvalidations(VCSInvalidations invalidations) Post-transaction invalidations notification.protected voidsetMetrics(String repositoryName) protected ACLRow[]sortACLRows(ACLRow[] acls) voidwrite(RowMapper.RowBatch batch) Writes a set of rows.
-
Field Details
-
cacheQueue
The queue of cache invalidations received from other session, to process at pre-transaction time. -
registry
protected final io.dropwizard.metrics5.MetricRegistry registryCache statistics- Since:
- 5.7
-
cacheHitCount
protected io.dropwizard.metrics5.Counter cacheHitCount -
cacheGetTimer
protected io.dropwizard.metrics5.Timer cacheGetTimer -
sorRows
protected io.dropwizard.metrics5.Counter sorRows -
sorGetTimer
protected io.dropwizard.metrics5.Timer sorGetTimer
-
-
Constructor Details
-
SoftRefCachingRowMapper
public SoftRefCachingRowMapper()
-
-
Method Details
-
initialize
-
setMetrics
-
close
public void close() -
generateNewId
Description copied from interface:RowMapperComputes a new unique id.- Specified by:
generateNewIdin interfaceRowMapper- Returns:
- a new unique id
-
isAbsent
-
cachePut
-
sortACLRows
-
cachePutAbsent
-
cachePutAbsentIfNull
-
cachePutAbsentIfRowId
-
cacheGet
-
cacheRemove
-
receiveInvalidations
Description copied from interface:RowMapperProcesses and returns the invalidations queued for processing by the cache (if any).Called pre-transaction by session start or transactionless save;
- Specified by:
receiveInvalidationsin interfaceRowMapper- Returns:
- the invalidations, or
null
-
sendInvalidations
Description copied from interface:RowMapperPost-transaction invalidations notification.Called post-transaction by session commit/rollback or transactionless save.
- Specified by:
sendInvalidationsin interfaceRowMapper- Parameters:
invalidations- the known invalidations to send to others, ornull
-
clearCache
public void clearCache()Description copied from interface:RowMapperClears the mapper's cache (if any)Called after a rollback, or a manual clear through RepositoryStatus MBean.
- Specified by:
clearCachein interfaceRowMapper
-
getCacheSize
public long getCacheSize()Description copied from interface:RowMapperEvaluate the cached elements size- Specified by:
getCacheSizein interfaceRowMapper
-
rollback
public void rollback()Description copied from interface:RowMapperRollback the transaction.This is in the
RowMapperinterface because on rollback the cache must be invalidated. -
read
Description copied from interface:RowMapper -
write
Description copied from interface:RowMapperWrites a set of rows. This includes creating, updating and deleting rows. -
readSimpleRow
Description copied from interface:RowMapperGets a row for aSimpleFragmentfrom the database, given its table name and id. If the row doesn't exist,nullis returned.- Specified by:
readSimpleRowin interfaceRowMapper- Parameters:
rowId- the row id- Returns:
- the row, or
null
-
getBinaryFulltext
Description copied from interface:RowMapperGets the fulltext extracted from the binary fields.- Specified by:
getBinaryFulltextin interfaceRowMapper- Parameters:
rowId- the row id- Returns:
- the fulltext string representation or
nullif unsupported
-
readCollectionRowArray
Description copied from interface:RowMapperGets an array for aCollectionFragmentfrom the database, given its table name and id. If no rows are found, an empty array is returned.- Specified by:
readCollectionRowArrayin interfaceRowMapper- Parameters:
rowId- the row id- Returns:
- the array
-
readSelectionRows
public List<Row> readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne) Description copied from interface:RowMapperReads the rows corresponding to a selection.- Specified by:
readSelectionRowsin interfaceRowMapper- Parameters:
selType- the selection typeselId- the selection id (parent id for a hierarchy selection)filter- the filter value (name for a hierarchy selection)criterion- an optional additional criterion depending on the selection type (complex prop flag for a hierarchy selection)limitToOne- whether to stop after one row retrieved- Returns:
- the list of rows
-
readSelectionsIds
Description copied from interface:RowMapperGets all the selection ids for a given list of values.- Specified by:
readSelectionsIdsin interfaceRowMapper
-
copy
public RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren, boolean excludeACL) Description copied from interface:RowMapperCopies the hierarchy starting from a given row to a new parent with a new name.If the new parent is
null, then this is a version creation, which doesn't recurse in regular children.If
overwriteRowis passed, the copy is done onto this existing node as its root (version restore) instead of creating a new node in the parent.- Specified by:
copyin interfaceRowMapper- Parameters:
source- the id, primary type and mixin types of the row to copydestParentId- the new parent id, ornulldestName- the new nameoverwriteRow- when notnull, the copy is done onto this existing row, and the values are set in hierarchyexcludeSpecialChildren- the flag to exclude special children from copyexcludeACL- the flag to exclude ACL from copy- Returns:
- info about the copy
-
getDescendantsInfo
Description copied from interface:RowMapperGets descendants infos from a given root node. This does not include information about the root node itself.- Specified by:
getDescendantsInfoin interfaceRowMapper- Parameters:
rootId- the root node id from which to get descendants info- Returns:
- the list of descendant nodes info
-
remove
Description copied from interface:RowMapperDeletes a hierarchy.
-