private class DynamicTablesHelper.DMOResourceManager extends java.lang.Object implements CacheExpiryListener<DynamicTablesHelper.CacheKey,DynamicTablesHelper.CacheData>
TODO: this cleanup currently is broken, as it can release resources that are still being used by a Hibernate session. The temporary workaround is to define a high cache limit, but this needs to be fixed.
Modifier and Type | Field and Description |
---|---|
private java.util.Set<TempTableBuilder> |
activeBuilders
Temp-table builders which are currently active across all contexts
|
private java.util.Set<DynamicTablesHelper.CacheData> |
expiredCacheData
Data which has expired from the cache, but has not yet been released
|
Constructor and Description |
---|
DMOResourceManager()
Constructor which registers with the dynamic DMO cache.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
builderActive(TempTableBuilder builder)
Track the given temp-table builder as being in use.
|
(package private) void |
builderInactive(TempTableBuilder builder)
Stop tracking the given temp-table builder as being in use.
|
void |
cacheExpired(CacheExpiryEvent<DynamicTablesHelper.CacheKey,DynamicTablesHelper.CacheData> event)
This method is invoked when the DMO cache has expired one or more elements.
|
(package private) void |
releasePendingResources()
Release resources which have expired from the dynamic DMO cache, which are no longer in
active use.
|
private final java.util.Set<TempTableBuilder> activeBuilders
private final java.util.Set<DynamicTablesHelper.CacheData> expiredCacheData
DMOResourceManager()
public void cacheExpired(CacheExpiryEvent<DynamicTablesHelper.CacheKey,DynamicTablesHelper.CacheData> event)
cacheExpired
in interface CacheExpiryListener<DynamicTablesHelper.CacheKey,DynamicTablesHelper.CacheData>
event
- An object containing information about the event.void builderActive(TempTableBuilder builder)
builder
- Temp-table builder to track.void builderInactive(TempTableBuilder builder)
builder
- Temp-table builder to stop tracking.void releasePendingResources()
TODO: this cleanup currently is broken, as it can release resources that are still being used by a Hibernate session. Also, if there are expired cache data, but they are still pinned by active builders, this method could be expensive to execute every time a new table is defined. Better to run it periodically in a dedicated thread. The temporary workaround is to define a high cache limit, but this needs to be fixed.