@ManagedResource(value="Reaper for jadice document platform objects") public class JadiceCacheReaper extends Object implements org.springframework.jmx.export.naming.SelfNaming, SelfRegistering, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, Runnable
Reaper class that attempts to clean the jadice global cache in a fixed interval to reduce memory consumption.
Background: Even though jadice server uses a thread local Cache
it might occur that some
data is stored in the global cache.
CacheManager.getDefault()
Constructor and Description |
---|
JadiceCacheReaper() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy() |
ClearableDocumentLayerCache |
getDocumentLayerCache() |
int |
getEnqueuedCacheEntryCount() |
int |
getEnqueuedDocumentLayerCount() |
JobScheduler |
getJobScheduler() |
ObjectName |
getObjectName() |
long |
getReapedCacheEntries() |
long |
getReapedDocumentLayers() |
int |
getTimeInterval() |
boolean |
isReapOnlyWhenIdle() |
void |
run() |
void |
setDocumentLayerCache(ClearableDocumentLayerCache documentLayerCache)
Replace the default
DocumentLayerCache by a custom one that will be cleared whenever
no jobs are running |
void |
setJobScheduler(JobScheduler jobScheduler)
The
JobScheduler on which the jadice server Job s are executed |
void |
setReapOnlyWhenIdle(boolean reapOnlyWhenIdle)
Choose if the cleansing is performed only when no jobs are running on jadice server
|
void |
setTimeInterval(int timeInterval)
Sets the time interval when to clean the jadice global cache
|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
@ManagedOperation(description="Run reaping manually") public void run()
@ManagedMetric(description="Number of enqueued non-default document layers", metricType=GAUGE) public int getEnqueuedDocumentLayerCount()
@ManagedMetric(description="Number of enqueued cache entries", metricType=GAUGE) public int getEnqueuedCacheEntryCount()
public void setTimeInterval(int timeInterval)
timeInterval
- time interval in seconds@ManagedAttribute(description="Time interval when the reaper runs (seconds)") public int getTimeInterval()
public void setReapOnlyWhenIdle(boolean reapOnlyWhenIdle)
reapOnlyWhenIdle
- if true
the cache is only cleaned when no jobs are running@ManagedAttribute(description="If this reaper only works when the server is idle, i.e. no jobs are running") public boolean isReapOnlyWhenIdle()
true
the cache is only cleaned when no jobs are runningpublic void setJobScheduler(JobScheduler jobScheduler)
JobScheduler
on which the jadice server Job
s are executedjobScheduler
- public JobScheduler getJobScheduler()
public void setDocumentLayerCache(ClearableDocumentLayerCache documentLayerCache)
DocumentLayerCache
by a custom one that will be cleared whenever
no jobs are runningdocumentLayerCache
- public ClearableDocumentLayerCache getDocumentLayerCache()
public ObjectName getObjectName() throws MalformedObjectNameException
getObjectName
in interface org.springframework.jmx.export.naming.SelfNaming
MalformedObjectNameException
@ManagedMetric(metricType=COUNTER, description="Number of reaped document layers") public long getReapedDocumentLayers()
@ManagedMetric(metricType=COUNTER, description="Number of reaped cache entries") public long getReapedCacheEntries()
Copyright © 2018 levigo holding gmbh. All rights reserved.