📄 cmsmemorymonitor.java
字号:
*/
public List getAllCachedPublishJobs() {
return new ArrayList(m_publishQueue);
}
/**
* Returns all cached publish jobs in the history as ordered list.<p>
*
* @return all cached publish jobs
*/
public List getAllCachedPublishJobsInHistory() {
return new ArrayList(m_publishHistory);
}
/**
* Returns the ACL cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the ACL cached with the given cache key
*/
public CmsAccessControlList getCachedACL(String key) {
return (CmsAccessControlList)m_accessControlListCache.get(key);
}
/**
* Returns the xml content definition cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the xml content definition cached with the given cache key
*/
public CmsXmlContentDefinition getCachedContentDefinition(String key) {
return (CmsXmlContentDefinition)m_contentDefinitionsCache.get(key);
}
/**
* Returns the group cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for, this may be the group's uuid or the fqn
*
* @return the group cached with the given cache key
*/
public CmsGroup getCachedGroup(String key) {
return (CmsGroup)m_groupCache.get(key);
}
/**
* Returns the locale cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the locale cached with the given cache key
*/
public Locale getCachedLocale(String key) {
if (m_localeCache == null) {
// this may be accessed before initialization
return null;
}
return (Locale)m_localeCache.get(key);
}
/**
* Returns the lock cached with the given root path or <code>null</code> if not found.<p>
*
* @param rootPath the root path to look for
*
* @return the lock cached with the given root path
*/
public CmsLock getCachedLock(String rootPath) {
return (CmsLock)m_lockCache.get(rootPath);
}
/**
* Returns the memory object cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the memory object cached with the given cache key
*/
public Object getCachedMemObject(String key) {
return m_memObjectCache.get(key);
}
/**
* Returns the organizational unit cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for, this may be the organizational unit's uuid or the fqn
*
* @return the organizational unit cached with the given cache key
*/
public CmsOrganizationalUnit getCachedOrgUnit(String key) {
return (CmsOrganizationalUnit)m_orgUnitCache.get(key);
}
/**
* Returns the permission check result cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the permission check result cached with the given cache key
*/
public I_CmsPermissionHandler.CmsPermissionCheckResult getCachedPermission(String key) {
return (I_CmsPermissionHandler.CmsPermissionCheckResult)m_permissionCache.get(key);
}
/**
* Returns the project cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for, this may be the project's uuid or the fqn
*
* @return the project cached with the given cache key
*/
public CmsProject getCachedProject(String key) {
return (CmsProject)m_projectCache.get(key);
}
/**
* Returns the project resources list cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the project resources list cached with the given cache key
*/
public List getCachedProjectResources(String key) {
return (List)m_projectResourcesCache.get(key);
}
/**
* Returns the property cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the property cached with the given cache key
*/
public CmsProperty getCachedProperty(String key) {
return (CmsProperty)m_propertyCache.get(key);
}
/**
* Returns the property list cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the property list cached with the given cache key
*/
public List getCachedPropertyList(String key) {
return (List)m_propertyListCache.get(key);
}
/**
* Returns the publish job with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the publish job with the given cache key
*/
public CmsPublishJobInfoBean getCachedPublishJob(String key) {
for (Iterator i = m_publishQueue.iterator(); i.hasNext();) {
CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)i.next();
if (publishJob.getPublishHistoryId().toString().equals(key)) {
return publishJob;
}
}
return null;
}
/**
* Returns the publish job from the history with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the publish job with the given cache key
*/
public CmsPublishJobInfoBean getCachedPublishJobInHistory(String key) {
for (Iterator i = m_publishHistory.iterator(); i.hasNext();) {
CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)i.next();
if (publishJob.getPublishHistoryId().toString().equals(key)) {
return publishJob;
}
}
return null;
}
/**
* Returns the resource cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the resource cached with the given cache key
*/
public CmsResource getCachedResource(String key) {
return (CmsResource)m_resourceCache.get(key);
}
/**
* Returns the resource list cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the resource list cached with the given cache key
*/
public List getCachedResourceList(String key) {
return (List)m_resourceListCache.get(key);
}
/**
* Returns the value cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return if the user has the given role
*/
public Boolean getCachedRole(String key) {
return (Boolean)m_rolesCache.get(key);
}
/**
* Returns the value cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return list of roles
*/
public List getCachedRoleList(String key) {
return (List)m_roleListsCache.get(key);
}
/**
* Returns the user cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for, this may be the user's uuid or the fqn
*
* @return the user cached with the given cache key
*/
public CmsUser getCachedUser(String key) {
return (CmsUser)m_userCache.get(key);
}
/**
* Returns the user groups list cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the user groups list cached with the given cache key
*/
public List getCachedUserGroups(String key) {
return (List)m_userGroupsCache.get(key);
}
/**
* Returns the vfs object cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the vfs object cached with the given cache key
*/
public Object getCachedVfsObject(String key) {
return m_vfsObjectCache.get(key);
}
/**
* Returns the xml permanent entity content cached with the given systemId or <code>null</code> if not found.<p>
*
* @param systemId the cache key to look for
*
* @return the xml permanent entity content cached with the given cache key
*/
public byte[] getCachedXmlPermanentEntity(String systemId) {
return (byte[])m_xmlPermanentEntityCache.get(systemId);
}
/**
* Returns the xml temporary entity content cached with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the xml temporary entity content cached with the given cache key
*/
public byte[] getCachedXmlTemporaryEntity(String key) {
return (byte[])m_xmlTemporaryEntityCache.get(key);
}
/**
* Returns the configuration.<p>
*
* @return the configuration
*/
public CmsMemoryMonitorConfiguration getConfiguration() {
return m_configuration;
}
/**
* Returns the next publish job from the publish job queue.<p>
*
* @return the next publish job
*/
public CmsPublishJobInfoBean getFirstCachedPublishJob() {
if (!m_publishQueue.isEmpty()) {
return (CmsPublishJobInfoBean)m_publishQueue.get();
} else {
return null;
}
}
/**
* Returns the log count.<p>
*
* @return the log count
*/
public int getLogCount() {
return m_logCount;
}
/**
* Initializes the monitor with the provided configuration.<p>
*
* @param configuration the configuration to use
*/
public void initialize(CmsSystemConfiguration configuration) {
CmsCacheSettings cacheSettings = configuration.getCacheSettings();
m_memoryAverage = new CmsMemoryStatus();
m_memoryCurrent = new CmsMemoryStatus();
m_warningSendSinceLastStatus = false;
m_warningLoggedSinceLastStatus = false;
m_lastEmailWarning = 0;
m_lastEmailStatus = 0;
m_lastLogStatus = 0;
m_lastLogWarning = 0;
m_lastClearCache = 0;
m_configuration = configuration.getCmsMemoryMonitorConfiguration();
m_intervalWarning = 720 * 60000;
m_maxUsagePercent = 90;
m_intervalEmail = m_configuration.getEmailInterval() * 1000;
m_intervalLog = m_configuration.getLogInterval() * 1000;
if (m_configuration.getWarningInterval() > 0) {
m_intervalWarning = m_configuration.getWarningInterval();
}
m_intervalWarning *= 1000;
if (m_configuration.getMaxUsagePercent() > 0) {
m_maxUsagePercent = m_configuration.getMaxUsagePercent();
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_INTERVAL_LOG_1,
new Integer(m_intervalLog / 1000)));
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_INTERVAL_EMAIL_1,
new Integer(m_intervalEmail / 1000)));
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_INTERVAL_WARNING_1,
new Integer(m_intervalWarning / 1000)));
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_INTERVAL_MAX_USAGE_1,
new Integer(m_maxUsagePercent)));
if ((m_configuration.getEmailReceiver() == null) || (m_configuration.getEmailSender() == null)) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_MM_EMAIL_DISABLED_0));
} else {
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_EMAIL_SENDER_1,
m_configuration.getEmailSender()));
Iterator i = m_configuration.getEmailReceiver().iterator();
int n = 0;
while (i.hasNext()) {
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.LOG_MM_EMAIL_RECEIVER_2,
new Integer(n + 1),
i.next()));
n++;
}
}
}
// create and register all system caches
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -