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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? threadcache.java

?? 解觖java技術中后臺無法上傳數給的情況
?? JAVA
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/ThreadCache.java,v 1.7 2006/04/14 17:05:26 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.7 $
 * $Date: 2006/04/14 17:05:26 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2006 by MyVietnam.net
 *
 * All copyright notices regarding mvnForum MUST remain 
 * intact in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in 
 * the footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info at MyVietnam net
 *
 * @author: Minh Nguyen  
 * @author: Mai  Nguyen  
 */
package com.mvnforum.db;

import java.util.Collection;

import com.mvnforum.MVNForumConfig;
import com.whirlycott.cache.*;
import net.myvietnam.mvncore.exception.AssertionException;
import net.myvietnam.mvncore.exception.DatabaseException;
import net.myvietnam.mvncore.util.DateUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ThreadCache {

    public static final long TIME_OUT = DateUtil.MINUTE * 10;

    private static Log log = LogFactory.getLog(ThreadCache.class);

    // static singleton variable
    static private ThreadCache instance = new ThreadCache();

    // instance variable
    private Cache cache;

    public ThreadCache() {
        //Use the cache manager to create the default cache
        try {
            if (MVNForumConfig.getEnableCacheThread()) {
                cache = CacheManager.getInstance().getCache("thread");
            }
        } catch (CacheException ex) {
            log.error("Cannot get the WhirlyCache. Thread caching is disabled.", ex);
        } catch (LinkageError e) {
            // @todo: Should be never throw
            log.error("Cannot get the WhirlyCache caused by Package Conflict. Thread caching is disabled.", e);
        }
    }

    /**
     * Returns the single instance
     * @return ThreadCache : the singleton instance.
     *
     * NOTE: if use normal singleton pattern, this method should be synchronized
     */
    static public ThreadCache getInstance() {
        return instance;
    }

    public String getEfficiencyReport() {
        String result = "No report";
        if (cache == null) {
            if (MVNForumConfig.getEnableCacheThread() == false) {
                result = "Cache is disabled.";
            } else {
                result = "Cache cannot be inited";
            }
        } else if (cache instanceof CacheDecorator) {
            result = ((CacheDecorator)cache).getEfficiencyReport();
        }
        return result;
    }

    public void clear() {
        if (cache != null) {
            cache.clear();
        }
    }

    public int getPreviousEnableThread(int forumID, int threadID)
        throws DatabaseException, AssertionException {

        Integer previousThreadID = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getPreviousEnableThread").append("_").append(forumID).append("_").append(threadID);
            String key = buffer.toString();
            previousThreadID = (Integer)cache.retrieve(key);
            if (previousThreadID == null) {
                int previousTopic = DAOFactory.getThreadDAO().getPreviousEnableThread(forumID, threadID);// can throw AssertionException
                previousThreadID = new Integer(previousTopic);

                cache.store(key, previousThreadID, TIME_OUT);
            }
        } else {
            int previousTopic = DAOFactory.getThreadDAO().getPreviousEnableThread(forumID, threadID);// can throw AssertionException
            previousThreadID = new Integer(previousTopic);
        }

        return previousThreadID.intValue();
    }

    public int getNextEnableThread(int forumID, int threadID)
        throws DatabaseException, AssertionException {

        Integer nextThreadID = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getNextEnableThread").append("_").append(forumID).append("_").append(threadID);
            String key = buffer.toString();
            nextThreadID = (Integer)cache.retrieve(key);
            if (nextThreadID == null) {
                int previousTopic = DAOFactory.getThreadDAO().getNextEnableThread(forumID, threadID);// can throw AssertionException
                nextThreadID = new Integer(previousTopic);

                cache.store(key, nextThreadID, TIME_OUT);
            }
        } else {
            int previousTopic = DAOFactory.getThreadDAO().getNextEnableThread(forumID, threadID);// can throw AssertionException
            nextThreadID = new Integer(previousTopic);
        }

        return nextThreadID.intValue();
    }

    public Collection getEnableGlobalAnnouncements()
        throws DatabaseException {

        Collection result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getEnableGlobalAnnouncements");
            String key = buffer.toString();
            result = (Collection)cache.retrieve(key);
            if (result == null) {
                result = DAOFactory.getThreadDAO().getEnableGlobalAnnouncements();

                cache.store(key, result, TIME_OUT);
            }
        } else {
            result = DAOFactory.getThreadDAO().getEnableGlobalAnnouncements();
        }

        return result;
    }

    public Collection getEnableForumAnnouncements_inForum(int forumID)
        throws DatabaseException {

        Collection result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getEnableForumAnnouncements_inForum").append(forumID);
            String key = buffer.toString();
            result = (Collection)cache.retrieve(key);
            if (result == null) {
                result = DAOFactory.getThreadDAO().getEnableForumAnnouncements_inForum(forumID);

                cache.store(key, result, TIME_OUT);
            }
        } else {
            result = DAOFactory.getThreadDAO().getEnableForumAnnouncements_inForum(forumID);
        }

        return result;
    }

    public Collection getEnableStickies_inForum(int forumID)
        throws DatabaseException {

        Collection result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getEnableStickies_inForum").append(forumID);
            String key = buffer.toString();
            result = (Collection)cache.retrieve(key);
            if (result == null) {
                result = DAOFactory.getThreadDAO().getEnableStickies_inForum(forumID);

                cache.store(key, result, TIME_OUT);
            }
        } else {
            result = DAOFactory.getThreadDAO().getEnableStickies_inForum(forumID);
        }

        return result;
    }

    public Collection getNormalEnableThreads_inForum_withSortSupport_limit(int forumID, int offset, int rowsToReturn, String sort, String order)
        throws DatabaseException {

        Collection result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getNormalEnableThreads_inForum_withSortSupport_limit");
            buffer.append(forumID).append("_");
            buffer.append(offset).append("_");
            buffer.append(rowsToReturn).append("_");
            buffer.append(sort).append("_");
            buffer.append(order).append("_");
            String key = buffer.toString();
            result = (Collection)cache.retrieve(key);
            if (result == null) {
                result = DAOFactory.getThreadDAO().getNormalEnableThreads_inForum_withSortSupport_limit(forumID, offset, rowsToReturn, sort, order);

                cache.store(key, result, TIME_OUT);
            }
        } else {
            result = DAOFactory.getThreadDAO().getNormalEnableThreads_inForum_withSortSupport_limit(forumID, offset, rowsToReturn, sort, order);
        }

        return result;
    }

    public int getNumberOfEnableThreads_inForum(int forumID)
        throws DatabaseException, AssertionException {

        Integer result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getNumberOfEnableThreads_inForum").append("_").append(forumID);
            String key = buffer.toString();
            result = (Integer)cache.retrieve(key);
            if (result == null) {
                int i = DAOFactory.getThreadDAO().getNumberOfEnableThreads_inForum(forumID);
                result = new Integer(i);

                cache.store(key, result, TIME_OUT);
            }
        } else {
            int i = DAOFactory.getThreadDAO().getNumberOfEnableThreads_inForum(forumID);
            result = new Integer(i);
        }

        return result.intValue();
    }

    public int getNumberOfNormalEnableThreads_inForum(int forumID)
        throws DatabaseException, AssertionException {

        Integer result = null;
        if (cache != null) {
            StringBuffer buffer = new StringBuffer(128);
            buffer.append("getNumberOfNormalEnableThreads_inForum").append("_").append(forumID);
            String key = buffer.toString();
            result = (Integer)cache.retrieve(key);
            if (result == null) {
                int i = DAOFactory.getThreadDAO().getNumberOfNormalEnableThreads_inForum(forumID);
                result = new Integer(i);

                cache.store(key, result, TIME_OUT);
            }
        } else {
            int i = DAOFactory.getThreadDAO().getNumberOfNormalEnableThreads_inForum(forumID);
            result = new Integer(i);
        }

        return result.intValue();
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一不卡视频| 成人午夜视频网站| www.欧美.com| 日韩欧美资源站| 国产成人啪午夜精品网站男同| 精品国产一区二区三区av性色| 欧美日韩午夜影院| 色哟哟国产精品| 成人av资源下载| 成人av网站大全| 精品日韩一区二区| 日韩欧美电影在线| 国产成人免费视频一区| 99免费精品在线| 精品久久久久久久久久久院品网 | 亚洲视频 欧洲视频| 看电视剧不卡顿的网站| 欧美巨大另类极品videosbest| 亚洲观看高清完整版在线观看 | 国产精品对白交换视频| 久久日韩精品一区二区五区| 精品剧情在线观看| 中文幕一区二区三区久久蜜桃| 国产精品久久久久久亚洲伦| 中文乱码免费一区二区| 看电视剧不卡顿的网站| 国产一区二区三区香蕉| 国产精品三级电影| 欧美日韩www| 美女脱光内衣内裤视频久久网站 | 懂色av噜噜一区二区三区av| 国产精品久久久久aaaa樱花| 91久久一区二区| 美女视频黄频大全不卡视频在线播放 | 色综合久久中文综合久久牛| 91色在线porny| 91精品国产综合久久久久久 | 亚洲综合区在线| 在线看国产日韩| 精品嫩草影院久久| 色综合天天天天做夜夜夜夜做| 日韩影院在线观看| 亚洲成a人在线观看| 欧美成人官网二区| 91亚洲国产成人精品一区二三| 免费观看成人鲁鲁鲁鲁鲁视频| 国产欧美一区视频| 日韩欧美视频在线| 91黄色免费看| 激情都市一区二区| 亚洲欧美偷拍卡通变态| 免费观看一级特黄欧美大片| 日本黄色一区二区| 国产精品入口麻豆九色| 久久99久久精品欧美| 美女网站色91| 欧美区在线观看| 国产精品人人做人人爽人人添| 国产一区二区在线看| 亚洲韩国精品一区| 成人动漫视频在线| 加勒比av一区二区| 韩国欧美国产1区| 色爱区综合激月婷婷| 91在线云播放| 日本高清视频一区二区| 一本色道**综合亚洲精品蜜桃冫| 国产婷婷一区二区| 国产精品久久久久7777按摩| 国产精品天天看| 石原莉奈在线亚洲三区| 玉米视频成人免费看| 精品视频1区2区| 日韩高清电影一区| 欧美电视剧免费全集观看| 精品一区二区三区免费毛片爱| 欧美电影精品一区二区| 91在线观看高清| 色综合天天综合网天天狠天天| 亚洲视频一二三区| 免费观看成人av| 美女看a上一区| 99久久精品一区| 欧美v日韩v国产v| 亚洲人成网站在线| 日本一不卡视频| 色偷偷成人一区二区三区91| 欧美一个色资源| 亚洲国产日韩a在线播放| 国产成人欧美日韩在线电影| 在线观看av一区| 国产午夜一区二区三区| 亚洲高清免费观看高清完整版在线观看 | 欧美亚一区二区| 亚洲免费在线观看| 久久精品视频免费| 欧美久久久久久久久| 国产成人在线视频网站| 日本中文一区二区三区| 国产精品久线在线观看| 欧美日韩精品二区第二页| 国产欧美日韩不卡| 麻豆精品一区二区av白丝在线| 日本道色综合久久| 亚洲国产精品久久久男人的天堂| 国产一区二区三区高清播放| 51午夜精品国产| 天天免费综合色| 欧美一区二区三区白人| 国产欧美日韩精品a在线观看| 国产精品456露脸| 久久久久久夜精品精品免费| 国产精品一卡二卡在线观看| 成人午夜精品在线| 午夜精品视频一区| 悠悠色在线精品| 一区二区在线看| 亚洲免费视频中文字幕| 亚洲丝袜自拍清纯另类| 中文一区二区在线观看| 精品va天堂亚洲国产| 欧美变态凌虐bdsm| 亚洲精品一区二区三区蜜桃下载| 欧美国产精品一区二区三区| 中文字幕中文字幕在线一区| 欧美久久一区二区| 精品国产亚洲在线| 国产98色在线|日韩| 国产性做久久久久久| 欧美午夜一区二区三区| 美女在线视频一区| 亚洲午夜久久久久久久久久久| 日韩一区二区高清| 99精品偷自拍| 国产精品一区二区三区四区| 亚洲欧美成人一区二区三区| 五月婷婷另类国产| 91色乱码一区二区三区| 国产精品一区在线观看乱码| caoporn国产精品| 欧美日本在线一区| 久久嫩草精品久久久精品一| 国产精品免费看片| 亚洲一区二区3| 国模娜娜一区二区三区| 91一区二区在线| 日韩一区二区三区视频| 国产精品18久久久久久久久| 一区二区三区成人| 成人动漫在线一区| 国产精品一区二区91| 国产成人在线视频播放| 欧美不卡一二三| 亚洲电影第三页| 亚洲免费av高清| 综合色天天鬼久久鬼色| 中文字幕日韩一区二区| 懂色一区二区三区免费观看| 国产69精品久久777的优势| 国产一区不卡精品| 国产美女av一区二区三区| 日韩电影免费一区| 久久精品二区亚洲w码| 国产精品乱码人人做人人爱| 午夜激情久久久| 91偷拍与自偷拍精品| 国产精品久久久久久久裸模| 欧美色成人综合| 午夜久久久久久电影| 日本韩国精品在线| 亚洲桃色在线一区| 91麻豆蜜桃一区二区三区| 欧美韩国日本综合| 国产精选一区二区三区| jlzzjlzz亚洲日本少妇| 久久av资源网| 国产99精品在线观看| 91国内精品野花午夜精品| 一区二区激情视频| 久久99精品久久久久婷婷| 国产a精品视频| 色视频欧美一区二区三区| 久久精品国产一区二区三| 91麻豆6部合集magnet| 91精品国产综合久久久久久| 国产精品午夜春色av| 首页国产欧美日韩丝袜| 国产高清不卡二三区| 欧美日韩电影一区| 国产精品国产三级国产普通话99 | 国产成+人+日韩+欧美+亚洲| 精品成人一区二区三区四区| 成人av在线播放网址| 亚洲激情五月婷婷| 日韩一级精品视频在线观看| 国产99精品在线观看| 丝袜亚洲另类丝袜在线| 久久久国产精华| 国产精品网站导航| 亚洲影院久久精品|