|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.monitor.CmsMemoryMonitor
public class CmsMemoryMonitor
Monitors OpenCms memory consumtion.
The memory monitor also provides all kind of caches used in the OpenCms core.
Constructor Summary | |
---|---|
CmsMemoryMonitor()
Empty constructor, required by OpenCms scheduler. |
Method Summary | |
---|---|
void |
cacheACL(java.lang.String key,
CmsAccessControlList acl)
Caches the given acl under the given cache key. |
void |
cacheContentDefinition(java.lang.String key,
CmsXmlContentDefinition contentDefinition)
Caches the given content definition under the given cache key. |
void |
cacheGroup(CmsGroup group)
Caches the given group under its id AND fully qualified name. |
void |
cacheLocale(java.lang.String key,
java.util.Locale locale)
Caches the given locale under the given cache key. |
void |
cacheLock(CmsLock lock)
Caches the given lock. |
void |
cacheMemObject(java.lang.String key,
java.lang.Object obj)
Caches the given object under the given cache key. |
void |
cacheOrgUnit(CmsOrganizationalUnit orgUnit)
Caches the given organizational under its id AND the fully qualified name. |
void |
cachePermission(java.lang.String key,
int permission)
Caches the given permission check result under the given cache key. |
void |
cacheProject(CmsProject project)
Caches the given project under its id AND the fully qualified name. |
void |
cacheProjectResources(java.lang.String key,
java.util.List projectResources)
Caches the given project resource list under the given cache key. |
void |
cacheProperty(java.lang.String key,
CmsProperty property)
Caches the given property under the given cache key. |
void |
cachePropertyList(java.lang.String key,
java.util.List propertyList)
Caches the given property list under the given cache key. |
void |
cachePublishJob(CmsPublishJobInfoBean publishJob)
Caches the given publish job. |
void |
cachePublishJobInHistory(CmsPublishJobInfoBean publishJob)
Caches the given publish job in the publish job history. |
void |
cacheResource(java.lang.String key,
CmsResource resource)
Caches the given resource under the given cache key. |
void |
cacheResourceList(java.lang.String key,
java.util.List resourceList)
Caches the given resource list under the given cache key. |
void |
cacheRole(java.lang.String key,
boolean hasRole)
Caches the given value under the given cache key. |
void |
cacheRoleList(java.lang.String key,
java.util.List roles)
Caches the given value under the given cache key. |
void |
cacheUser(CmsUser user)
Caches the given user under its id AND the fully qualified name. |
void |
cacheUserGroups(java.lang.String key,
java.util.List userGroups)
Caches the given list of user groups under the given cache key. |
void |
cacheVfsObject(java.lang.String key,
java.lang.Object obj)
Caches the given vfs object under the given cache key. |
void |
cacheXmlPermanentEntity(java.lang.String systemId,
byte[] content)
Caches the given xml entity under the given system id. |
void |
cacheXmlTemporaryEntity(java.lang.String key,
byte[] content)
Caches the given xml entity under the given cache key. |
boolean |
enabled()
Returns if monitoring is enabled. |
void |
flushACLs()
Flushes the ACL cache. |
void |
flushContentDefinitions()
Flushes the xml content definitions cache. |
void |
flushGroups()
Flushes the group cache. |
void |
flushLocales()
Flushes the locale cache. |
void |
flushLocks(java.util.Map newLocks)
Flushes the locks cache. |
void |
flushMemObjects()
Flushes the memory object cache. |
void |
flushOrgUnits()
Flushes the organizational unit cache. |
void |
flushPermissions()
Flushes the permission check result cache. |
void |
flushProjectResources()
Flushes the project resources cache. |
void |
flushProjects()
Flushes the project cache. |
void |
flushProperties()
Flushes the property cache. |
void |
flushPropertyLists()
Flushes the property list cache. |
void |
flushPublishJobHistory()
Flushes the publish history. |
void |
flushPublishJobs()
Flushes the publish queue. |
void |
flushResourceLists()
Flushes the resource list cache. |
void |
flushResources()
Flushes the resource cache. |
void |
flushRoleLists()
Flushes the role lists cache. |
void |
flushRoles()
Flushes the roles cache. |
void |
flushUserGroups()
Flushes the user groups cache. |
void |
flushUsers()
Flushes the users cache. |
void |
flushVfsObjects()
Flushes the vfs object cache. |
void |
flushXmlPermanentEntities()
Flushes the xml permanent entities cache. |
void |
flushXmlTemporaryEntities()
Flushes the xml temporary entities cache. |
java.util.List |
getAllCachedLockPaths()
Returns all cached lock root paths. |
java.util.List |
getAllCachedLocks()
Returns all cached locks. |
java.util.List |
getAllCachedPublishJobs()
Returns all cached publish jobs in the queue as ordered list. |
java.util.List |
getAllCachedPublishJobsInHistory()
Returns all cached publish jobs in the history as ordered list. |
CmsAccessControlList |
getCachedACL(java.lang.String key)
Returns the ACL cached with the given cache key or null if not found. |
CmsXmlContentDefinition |
getCachedContentDefinition(java.lang.String key)
Returns the xml content definition cached with the given cache key or null if not found. |
CmsGroup |
getCachedGroup(java.lang.String key)
Returns the group cached with the given cache key or null if not found. |
java.util.Locale |
getCachedLocale(java.lang.String key)
Returns the locale cached with the given cache key or null if not found. |
CmsLock |
getCachedLock(java.lang.String rootPath)
Returns the lock cached with the given root path or null if not found. |
java.lang.Object |
getCachedMemObject(java.lang.String key)
Returns the memory object cached with the given cache key or null if not found. |
CmsOrganizationalUnit |
getCachedOrgUnit(java.lang.String key)
Returns the organizational unit cached with the given cache key or null if not found. |
java.lang.Integer |
getCachedPermission(java.lang.String key)
Returns the permission check result cached with the given cache key or null if not found. |
CmsProject |
getCachedProject(java.lang.String key)
Returns the project cached with the given cache key or null if not found. |
java.util.List |
getCachedProjectResources(java.lang.String key)
Returns the project resources list cached with the given cache key or null if not found. |
CmsProperty |
getCachedProperty(java.lang.String key)
Returns the property cached with the given cache key or null if not found. |
java.util.List |
getCachedPropertyList(java.lang.String key)
Returns the property list cached with the given cache key or null if not found. |
CmsPublishJobInfoBean |
getCachedPublishJob(java.lang.String key)
Returns the publish job with the given cache key or null if not found. |
CmsPublishJobInfoBean |
getCachedPublishJobInHistory(java.lang.String key)
Returns the publish job from the history with the given cache key or null if not found. |
CmsResource |
getCachedResource(java.lang.String key)
Returns the resource cached with the given cache key or null if not found. |
java.util.List |
getCachedResourceList(java.lang.String key)
Returns the resource list cached with the given cache key or null if not found. |
java.lang.Boolean |
getCachedRole(java.lang.String key)
Returns the value cached with the given cache key or null if not found. |
java.util.List |
getCachedRoleList(java.lang.String key)
Returns the value cached with the given cache key or null if not found. |
CmsUser |
getCachedUser(java.lang.String key)
Returns the user cached with the given cache key or null if not found. |
java.util.List |
getCachedUserGroups(java.lang.String key)
Returns the user groups list cached with the given cache key or null if not found. |
java.lang.Object |
getCachedVfsObject(java.lang.String key)
Returns the vfs object cached with the given cache key or null if not found. |
byte[] |
getCachedXmlPermanentEntity(java.lang.String systemId)
Returns the xml permanent entity content cached with the given systemId or null if not found. |
byte[] |
getCachedXmlTemporaryEntity(java.lang.String key)
Returns the xml temporary entity content cached with the given cache key or null if not found. |
CmsMemoryMonitorConfiguration |
getConfiguration()
Returns the configuration. |
CmsPublishJobInfoBean |
getFirstCachedPublishJob()
Returns the next publish job from the publish job queue. |
int |
getLogCount()
Returns the log count. |
static int |
getMemorySize(java.lang.Object obj)
Returns the size of objects that are instances of byte[] , String , CmsFile ,I_CmsLruCacheObject . |
void |
initialize(CmsSystemConfiguration configuration)
Initializes the monitor with the provided configuration. |
boolean |
isMonitoring(java.lang.String key)
Checks if there is a registered monitored object with the given key. |
java.lang.String |
launch(CmsObject cms,
java.util.Map parameters)
This method will be called when this scheduled job is executed. |
boolean |
lowMemory()
Returns true if the system runs low on memory. |
void |
register(java.lang.String objectName,
java.lang.Object object)
Adds a new object to the monitor. |
boolean |
requiresPersistency()
Checks if some kind of persistency is required. |
void |
shutdown()
Flushes all cached objects. |
void |
uncacheContentDefinition(java.lang.String key)
Removes the given xml content definition from the cache. |
void |
uncacheGroup(CmsGroup group)
Removes the given group from the cache. |
void |
uncacheLock(java.lang.String rootPath)
Removes the cached lock for the given root path from the cache. |
void |
uncacheOrgUnit(CmsOrganizationalUnit orgUnit)
Removes the given organizational unit from the cache. |
void |
uncacheProject(CmsProject project)
Removes the given project from the cache. |
void |
uncachePublishJob(CmsPublishJobInfoBean publishJob)
Removes the given publish job from the cache. |
void |
uncachePublishJobInHistory(CmsPublishJobInfoBean publishJob)
Removes the given publish job from the history. |
void |
uncacheUser(CmsUser user)
Removes the given user from the cache. |
void |
uncacheVfsObject(java.lang.String key)
Removes the given vfs object from the cache. |
void |
uncacheXmlTemporaryEntity(java.lang.String key)
Removes the given xml temporary entity from the cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsMemoryMonitor()
Method Detail |
---|
public static int getMemorySize(java.lang.Object obj)
byte[]
, String
, CmsFile
,I_CmsLruCacheObject
.For other objects, a size of 0 is returned.
obj
- the object
public void cacheACL(java.lang.String key, CmsAccessControlList acl)
key
- the cache keyacl
- the acl to cachepublic void cacheContentDefinition(java.lang.String key, CmsXmlContentDefinition contentDefinition)
key
- the cache keycontentDefinition
- the content definition to cachepublic void cacheGroup(CmsGroup group)
group
- the group to cachepublic void cacheLocale(java.lang.String key, java.util.Locale locale)
key
- the cache keylocale
- the locale to cachepublic void cacheLock(CmsLock lock)
The lock is cached by it resource's root path.
lock
- the lock to cachepublic void cacheMemObject(java.lang.String key, java.lang.Object obj)
key
- the cache keyobj
- the object to cachepublic void cacheOrgUnit(CmsOrganizationalUnit orgUnit)
orgUnit
- the organizational unit to cachepublic void cachePermission(java.lang.String key, int permission)
key
- the cache keypermission
- the permission check result to cachepublic void cacheProject(CmsProject project)
project
- the project to cachepublic void cacheProjectResources(java.lang.String key, java.util.List projectResources)
key
- the cache keyprojectResources
- the project resources to cachepublic void cacheProperty(java.lang.String key, CmsProperty property)
key
- the cache keyproperty
- the property to cachepublic void cachePropertyList(java.lang.String key, java.util.List propertyList)
key
- the cache keypropertyList
- the property list to cachepublic void cachePublishJob(CmsPublishJobInfoBean publishJob)
publishJob
- the publish jobpublic void cachePublishJobInHistory(CmsPublishJobInfoBean publishJob)
publishJob
- the publish jobpublic void cacheResource(java.lang.String key, CmsResource resource)
key
- the cache keyresource
- the resource to cachepublic void cacheResourceList(java.lang.String key, java.util.List resourceList)
key
- the cache keyresourceList
- the resource list to cachepublic void cacheRole(java.lang.String key, boolean hasRole)
key
- the cache keyhasRole
- if the user has the given rolepublic void cacheRoleList(java.lang.String key, java.util.List roles)
key
- the cache keyroles
- the roles of the userpublic void cacheUser(CmsUser user)
user
- the user to cachepublic void cacheUserGroups(java.lang.String key, java.util.List userGroups)
key
- the cache keyuserGroups
- the list of user groups to cachepublic void cacheVfsObject(java.lang.String key, java.lang.Object obj)
key
- the cache keyobj
- the vfs object to cachepublic void cacheXmlPermanentEntity(java.lang.String systemId, byte[] content)
systemId
- the cache keycontent
- the content to cachepublic void cacheXmlTemporaryEntity(java.lang.String key, byte[] content)
key
- the cache keycontent
- the content to cachepublic boolean enabled()
public void flushACLs()
public void flushContentDefinitions()
public void flushGroups()
public void flushLocales()
public void flushLocks(java.util.Map newLocks)
newLocks
- if not null
the lock cache is replaced by the given mappublic void flushMemObjects()
public void flushOrgUnits()
public void flushPermissions()
public void flushProjectResources()
public void flushProjects()
public void flushProperties()
public void flushPropertyLists()
public void flushPublishJobHistory()
public void flushPublishJobs()
public void flushResourceLists()
public void flushResources()
public void flushRoleLists()
public void flushRoles()
public void flushUserGroups()
public void flushUsers()
public void flushVfsObjects()
public void flushXmlPermanentEntities()
public void flushXmlTemporaryEntities()
public java.util.List getAllCachedLockPaths()
String
objectspublic java.util.List getAllCachedLocks()
CmsLock
objectspublic java.util.List getAllCachedPublishJobs()
public java.util.List getAllCachedPublishJobsInHistory()
public CmsAccessControlList getCachedACL(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsXmlContentDefinition getCachedContentDefinition(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsGroup getCachedGroup(java.lang.String key)
null
if not found.
key
- the cache key to look for, this may be the group's uuid or the fqn
public java.util.Locale getCachedLocale(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsLock getCachedLock(java.lang.String rootPath)
null
if not found.
rootPath
- the root path to look for
public java.lang.Object getCachedMemObject(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsOrganizationalUnit getCachedOrgUnit(java.lang.String key)
null
if not found.
key
- the cache key to look for, this may be the organizational unit's uuid or the fqn
public java.lang.Integer getCachedPermission(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsProject getCachedProject(java.lang.String key)
null
if not found.
key
- the cache key to look for, this may be the project's uuid or the fqn
public java.util.List getCachedProjectResources(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsProperty getCachedProperty(java.lang.String key)
null
if not found.
key
- the cache key to look for
public java.util.List getCachedPropertyList(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsPublishJobInfoBean getCachedPublishJob(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsPublishJobInfoBean getCachedPublishJobInHistory(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsResource getCachedResource(java.lang.String key)
null
if not found.
key
- the cache key to look for
public java.util.List getCachedResourceList(java.lang.String key)
null
if not found.
key
- the cache key to look for
public java.lang.Boolean getCachedRole(java.lang.String key)
null
if not found.
key
- the cache key to look for
public java.util.List getCachedRoleList(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsUser getCachedUser(java.lang.String key)
null
if not found.
key
- the cache key to look for, this may be the user's uuid or the fqn
public java.util.List getCachedUserGroups(java.lang.String key)
null
if not found.
key
- the cache key to look for
public java.lang.Object getCachedVfsObject(java.lang.String key)
null
if not found.
key
- the cache key to look for
public byte[] getCachedXmlPermanentEntity(java.lang.String systemId)
null
if not found.
systemId
- the cache key to look for
public byte[] getCachedXmlTemporaryEntity(java.lang.String key)
null
if not found.
key
- the cache key to look for
public CmsMemoryMonitorConfiguration getConfiguration()
public CmsPublishJobInfoBean getFirstCachedPublishJob()
public int getLogCount()
public void initialize(CmsSystemConfiguration configuration)
configuration
- the configuration to usepublic boolean isMonitoring(java.lang.String key)
key
- the key to look for
true
if there is a registered monitored object with the given keypublic java.lang.String launch(CmsObject cms, java.util.Map parameters) throws java.lang.Exception
I_CmsScheduledJob
Depending on the configuration of this job, a new instance of the configured class will be instanciated every time the job is launched, or a new instance will be generated only the first time the job is launched, and re-used afterwards.
The result String will be written to the OpenCms logfile in the
org.opencms.scheduler.CmsScheduleManager
channel,
on INFO
log level.
launch
in interface I_CmsScheduledJob
cms
- will be initialized with the configured users cms contextparameters
- the configured parameters
java.lang.Exception
- if something goes wrongI_CmsScheduledJob.launch(CmsObject, Map)
public boolean lowMemory()
public void register(java.lang.String objectName, java.lang.Object object)
objectName
- name of the objectobject
- the object for monitoringpublic boolean requiresPersistency()
This could be overwritten in a distributed environment.
true
if some kind of persistency is requiredpublic void shutdown() throws java.lang.Exception
java.lang.Exception
- if something goes wrongpublic void uncacheContentDefinition(java.lang.String key)
key
- the cache key to remove from cachepublic void uncacheGroup(CmsGroup group)
The group is removed by name AND also by uuid.
group
- the group to remove from cachepublic void uncacheLock(java.lang.String rootPath)
rootPath
- the root path of the lock to remove from cachepublic void uncacheOrgUnit(CmsOrganizationalUnit orgUnit)
The organizational unit is removed by name AND also by uuid.
orgUnit
- the organizational unit to remove from cachepublic void uncacheProject(CmsProject project)
The project is removed by name AND also by uuid.
project
- the project to remove from cachepublic void uncachePublishJob(CmsPublishJobInfoBean publishJob)
publishJob
- the publish job to removepublic void uncachePublishJobInHistory(CmsPublishJobInfoBean publishJob)
publishJob
- the publish job to removepublic void uncacheUser(CmsUser user)
The user is removed by name AND also by uuid.
user
- the user to remove from cachepublic void uncacheVfsObject(java.lang.String key)
key
- the cache key to remove from cachepublic void uncacheXmlTemporaryEntity(java.lang.String key)
key
- the cache key to remove from cache
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |