亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cmsmemorymonitor.java

?? cms是開源的框架
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/monitor/CmsMemoryMonitor.java,v $
 * Date   : $Date: 2006/03/27 14:53:04 $
 * Version: $Revision: 1.58 $
 *
 * This library is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software GmbH, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.opencms.monitor;

import org.opencms.cache.CmsLruCache;
import org.opencms.file.CmsFile;
import org.opencms.file.CmsGroup;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsProject;
import org.opencms.file.CmsProperty;
import org.opencms.file.CmsPropertyDefinition;
import org.opencms.file.CmsResource;
import org.opencms.file.CmsUser;
import org.opencms.flex.CmsFlexCache.CmsFlexCacheVariation;
import org.opencms.mail.CmsMailTransport;
import org.opencms.mail.CmsSimpleMail;
import org.opencms.main.CmsEvent;
import org.opencms.main.CmsLog;
import org.opencms.main.CmsSessionManager;
import org.opencms.main.I_CmsEventListener;
import org.opencms.main.OpenCms;
import org.opencms.scheduler.I_CmsScheduledJob;
import org.opencms.security.CmsAccessControlList;
import org.opencms.security.CmsPermissionSet;
import org.opencms.util.CmsDateUtil;
import org.opencms.util.CmsStringUtil;
import org.opencms.util.CmsUUID;
import org.opencms.util.PrintfFormat;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.mail.internet.InternetAddress;

import org.apache.commons.collections.map.LRUMap;
import org.apache.commons.logging.Log;

/**
 * Monitors OpenCms memory consumtion.<p>
 * 
 * @author Carsten Weinholz 
 * @author Michael Emmerich 
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.58 $ 
 * 
 * @since 6.0.0 
 */
public class CmsMemoryMonitor implements I_CmsScheduledJob {

    /** Set interval for clearing the caches to 10 minutes. */
    private static final int INTERVAL_CLEAR = 1000 * 60 * 10;

    /** The log object for this class. */
    private static final Log LOG = CmsLog.getLog(CmsMemoryMonitor.class);

    /** Flag indicating if monitor is currently running. */
    private static boolean m_currentlyRunning;

    /** Maximum depth for object size recursion. */
    private static final int MAX_DEPTH = 5;

    /** The memory monitor configuration. */
    private CmsMemoryMonitorConfiguration m_configuration;

    /** Interval in which emails are send. */
    private int m_intervalEmail;

    /** Interval in which the log is written. */
    private int m_intervalLog;

    /** Interval between 2 warnings. */
    private int m_intervalWarning;

    /** The time the caches were last cleared. */
    private long m_lastClearCache;

    /** The time the last status email was send. */
    private long m_lastEmailStatus;

    /** The time the last warning email was send. */
    private long m_lastEmailWarning;

    /** The time the last status log was written. */
    private long m_lastLogStatus;

    /** The time the last warning log was written. */
    private long m_lastLogWarning;

    /** The number of times the log entry was written. */
    private int m_logCount;

    /** Memory percentage to reach to go to warning level. */
    private int m_maxUsagePercent;

    /** The average memory status. */
    private CmsMemoryStatus m_memoryAverage;

    /** The current memory status. */
    private CmsMemoryStatus m_memoryCurrent;

    /** Contains the object to be monitored. */
    private Map m_monitoredObjects;

    /** Flag for memory warning mail send. */
    private boolean m_warningLoggedSinceLastStatus;

    /** Flag for memory warning mail send. */
    private boolean m_warningSendSinceLastStatus;

    /**
     * Empty constructor, required by OpenCms scheduler.<p>
     */
    public CmsMemoryMonitor() {

        m_monitoredObjects = new HashMap();
    }

    /**
     * Returns the size of objects that are instances of
     * <code>byte[]</code>, <code>String</code>, <code>CmsFile</code>,<code>I_CmsLruCacheObject</code>.<p>
     * For other objects, a size of 0 is returned.
     * 
     * @param obj the object
     * @return the size of the object 
     */
    public static int getMemorySize(Object obj) {

        if (obj instanceof I_CmsMemoryMonitorable) {
            return ((I_CmsMemoryMonitorable)obj).getMemorySize();
        }

        if (obj instanceof byte[]) {
            // will always be a total of 16 + 8
            return 8 + (int)(Math.ceil(((byte[])obj).length / 16.0) * 16.0);
        }

        if (obj instanceof String) {
            // will always be a total of 16 + 24
            return 24 + (int)(Math.ceil(((String)obj).length() / 8.0) * 16.0);
        }

        if (obj instanceof CmsFile) {
            CmsFile f = (CmsFile)obj;
            if (f.getContents() != null) {
                return f.getContents().length + 1024;
            } else {
                return 1024;
            }
        }

        if (obj instanceof CmsUUID) {
            return 184; // worst case if UUID String has been generated
        }

        if (obj instanceof CmsPermissionSet) {
            return 16; // two ints
        }

        if (obj instanceof CmsResource) {
            return 1024; // estimated size
        }

        if (obj instanceof CmsUser) {
            return 2048; // estimated size
        }

        if (obj instanceof CmsGroup) {
            return 512; // estimated size
        }

        if (obj instanceof CmsProject) {
            return 512;
        }

        if (obj instanceof Boolean) {
            return 8; // one boolean
        }

        if (obj instanceof CmsProperty) {
            int size = 8;

            CmsProperty property = (CmsProperty)obj;
            size += getMemorySize(property.getName());

            if (property.getResourceValue() != null) {
                size += getMemorySize(property.getResourceValue());
            }

            if (property.getStructureValue() != null) {
                size += getMemorySize(property.getStructureValue());
            }

            return size;
        }

        if (obj instanceof CmsPropertyDefinition) {
            int size = 8;

            CmsPropertyDefinition propDef = (CmsPropertyDefinition)obj;
            size += getMemorySize(propDef.getName());
            size += getMemorySize(propDef.getId());

            return size;
        }

        // System.err.println("Unresolved: " + obj.getClass().getName());
        return 8;
    }

    /**
     * Returns if monitoring is enabled.<p>
     * 
     * @return true if monitoring is enabled
     */
    public boolean enabled() {

        return true;
    }

    /**
     * Returns the configuration.<p>
     *
     * @return the configuration
     */
    public CmsMemoryMonitorConfiguration getConfiguration() {

        return m_configuration;
    }

    /**
     * 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(CmsMemoryMonitorConfiguration configuration) {

        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;

        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)));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情综合网| 国产**成人网毛片九色| 大尺度一区二区| 欧美精品一级二级三级| 一区精品在线播放| 精品一区二区三区欧美| 欧美区视频在线观看| 国产精品久久777777| 久久国产乱子精品免费女| 在线视频欧美区| 国产精品高潮呻吟| 国产一区二区三区四| 欧美一区二区三区四区五区 | 日本不卡1234视频| 色综合天天在线| 国产精品午夜春色av| 韩日av一区二区| 欧美成人在线直播| 蜜桃久久久久久| 欧美一二三区精品| 天天色天天爱天天射综合| 欧美色图12p| 一区二区三区在线视频观看| 成人av免费在线观看| 久久蜜桃av一区精品变态类天堂 | 日韩欧美一区中文| 五月婷婷激情综合| 在线电影一区二区三区| 亚洲小说春色综合另类电影| 欧美综合色免费| 亚洲福利电影网| 欧美在线小视频| 午夜欧美电影在线观看| 欧美另类久久久品| 日日夜夜精品视频免费| 91精品国产综合久久精品性色 | 日韩欧美亚洲另类制服综合在线| 日本不卡高清视频| 亚洲精品一区二区三区福利| 狠狠狠色丁香婷婷综合激情 | 色乱码一区二区三区88| 亚洲欧美日韩综合aⅴ视频| 精品剧情在线观看| 国产精品资源在线| 国产精品久久久久影视| 在线亚洲一区二区| 污片在线观看一区二区| 亚洲精品一线二线三线无人区| 国产在线播放一区二区三区| 欧美高清在线视频| 欧美日韩综合在线免费观看| 日本成人在线电影网| 久久久亚洲高清| 日本精品一区二区三区四区的功能| 亚洲自拍偷拍麻豆| 欧美一级在线免费| 国产成人超碰人人澡人人澡| 一区二区三区四区视频精品免费| 7777精品伊人久久久大香线蕉| 久久99国产乱子伦精品免费| 国产精品麻豆网站| 69p69国产精品| 成人午夜在线免费| 日韩综合在线视频| 国产精品久久久久四虎| 91精品国产91久久久久久最新毛片| 国产精品亚洲一区二区三区妖精| 亚洲色大成网站www久久九九| 欧美一区二区性放荡片| 成人午夜激情在线| 日本不卡123| 亚洲精品自拍动漫在线| 精品国产电影一区二区| 色综合久久久久久久久久久| 极品瑜伽女神91| 一二三区精品视频| 中文字幕av一区 二区| 欧美久久久久久久久| 成人av动漫网站| 精品一二三四区| 丝袜国产日韩另类美女| 亚洲欧美一区二区久久| 久久精品人人做| 日韩精品一区二| 欧美在线免费观看视频| av不卡免费电影| 国产精品羞羞答答xxdd| 老司机免费视频一区二区三区| 亚洲美腿欧美偷拍| 日本一区二区三区dvd视频在线| 欧美精品 日韩| 欧美无人高清视频在线观看| 波多野结衣在线aⅴ中文字幕不卡| 精品一区二区三区免费播放 | 亚洲一区二区精品久久av| 国产欧美日韩麻豆91| 久久亚洲精华国产精华液 | 国精产品一区一区三区mba视频| 亚洲一区二区视频在线观看| 国产精品电影一区二区三区| 久久一区二区三区国产精品| 日韩精品一区二区三区视频| 欧美另类高清zo欧美| 欧美日韩国产精选| 欧美三级蜜桃2在线观看| 色噜噜久久综合| 色婷婷一区二区| 91视视频在线观看入口直接观看www| 国产成人自拍在线| 国产99一区视频免费| 韩国av一区二区三区在线观看| 看片的网站亚洲| 久国产精品韩国三级视频| 久久精品99国产精品| 麻豆精品蜜桃视频网站| 韩国v欧美v日本v亚洲v| 国产一区二区三区最好精华液| 7777精品伊人久久久大香线蕉完整版 | 久久国内精品视频| 奇米精品一区二区三区四区 | 色婷婷综合久久久中文字幕| 91美女视频网站| 在线观看国产一区二区| 欧美日韩激情一区| 3atv一区二区三区| 欧美tickling挠脚心丨vk| 久久香蕉国产线看观看99| 欧美激情一区二区在线| 1区2区3区精品视频| 亚洲无人区一区| 看片的网站亚洲| 成人h精品动漫一区二区三区| 91亚洲精品久久久蜜桃| 欧美日本一道本| 精品粉嫩aⅴ一区二区三区四区| 国产日韩精品一区二区三区在线| 国产精品国产三级国产有无不卡| 亚洲欧洲制服丝袜| 日本不卡一二三| 成人伦理片在线| 欧美精品免费视频| 国产亚洲精品久| 亚洲一区精品在线| 国产一区二区三区四区在线观看| 9人人澡人人爽人人精品| 欧美日韩成人一区二区| 久久久夜色精品亚洲| 亚洲免费观看高清完整版在线 | 亚洲日本乱码在线观看| 亚洲一区二区精品视频| 国产一区二区电影| 在线视频欧美精品| 国产亚洲人成网站| 五月婷婷激情综合网| 成人性生交大片免费看中文 | 中文字幕一区二区三区精华液| 午夜久久久久久| 国产99精品在线观看| 欧美日韩免费一区二区三区| 久久久精品国产免大香伊| 亚洲夂夂婷婷色拍ww47| 国产精品一区2区| 欧美日韩国产高清一区| 中国色在线观看另类| 日本va欧美va精品| 色婷婷国产精品| 国产女人水真多18毛片18精品视频| 亚洲国产日日夜夜| 波多野结衣亚洲一区| 欧美成人激情免费网| 亚洲大片一区二区三区| 99精品一区二区三区| 久久你懂得1024| 另类小说一区二区三区| 欧美午夜影院一区| 亚洲欧美一区二区三区孕妇| 国产高清精品久久久久| 日韩三级视频在线看| 亚洲国产aⅴ天堂久久| 91蜜桃婷婷狠狠久久综合9色| 日韩欧美高清一区| 婷婷综合在线观看| 欧美少妇xxx| 亚洲自拍偷拍欧美| 色噜噜狠狠成人网p站| 中文字幕在线免费不卡| 国产一区二区精品久久99| 日韩视频在线观看一区二区| 亚洲成年人网站在线观看| 91丨porny丨中文| 亚洲欧洲国产日本综合| 成人av电影在线播放| 日韩电影免费一区| 欧美高清dvd| 日日夜夜免费精品视频| 欧美日韩性生活| 亚洲成人av在线电影| 欧美日本一区二区三区| 奇米精品一区二区三区四区 | 成人国产亚洲欧美成人综合网|