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

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

?? resourcemanager.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2000-2004 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: ResourceManager.java,v 1.2 2005/03/18 03:58:39 tanderson Exp $
 */
package org.exolab.jms.messagemgr;

import java.io.File;
import java.io.FilenameFilter;
import java.sql.Connection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.Vector;

import javax.jms.JMSException;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.exolab.jms.service.BasicService;
import org.exolab.jms.service.ServiceException;
import org.exolab.jms.service.ServiceState;
import org.exolab.jms.common.uuid.UUID;
import org.exolab.jms.message.MessageImpl;
import org.exolab.jms.persistence.DatabaseService;
import org.exolab.jms.persistence.PersistenceException;
import org.exolab.jms.persistence.SQLHelper;
import org.exolab.jms.tranlog.ExternalXid;
import org.exolab.jms.tranlog.StateTransactionLogEntry;
import org.exolab.jms.tranlog.TransactionLog;
import org.exolab.jms.tranlog.TransactionLogException;
import org.exolab.jms.tranlog.TransactionState;
import org.exolab.jms.tranlog.DataTransactionLogEntry;


/**
 * The resource manager provides XA support for the JMS Server.
 * <p>
 * The resource manager is responsible for managing the various transaction
 * identifiers and managing the association between transaction ids and
 * connections.
 * <p>
 * The resource manager will store the global XID's and their state in the
 * database for recovery purposes.
 * <p>
 * Messages that arrive, and are associated with an XID are not processed
 * through the {@link MessageMgr}. Instead they are routed to this resource
 * managers where they are cached until the associated XID is committed or
 * rolled back. If the transaction is successfully committed, through the 2PC
 * protocol the messages will pass through the system.
 * <p>
 * Similarly, messages that are sent to consumers, either synchronously or
 * asynchronously are also cached by the resource manager until the global
 * transaction completes.
 * <p>
 * On startup the resource manager will read all incomplete transactions, which
 * are incompleted into memory. It will then process trnasactions that have
 * timed out.
 * <p>
 * The transaction manager will call the {@link #recover} method  and obtain a
 * list of incomplete transaction for the purpose of completing them where
 * possible.
 *
 * @version   $Revision: 1.2 $ $Date: 2005/03/18 03:58:39 $
 * @author    <a href="mailto:jima@intalio.com">Jim Alateras</a>
 */
public class ResourceManager
    extends BasicService {

    /**
     * The name of the service
     */
    private final static String RM_SERVICE_NAME = "XAResourceManager";

    /**
     * The prefix used for all transaction log files, which are created and
     * managed by the {@link TransactionLog}
     */
    private final static String RM_LOGFILE_PREFIX = "ojmsrm";

    /**
     * The extension for all transaction log files
     */
    public final static String RM_LOGFILE_EXTENSION = ".log";

    /**
     * This is used to indicate the garbage collection has been disabled and
     * that the client will take responsibility for all aspects of log file
     * management. This is useful in situations where the client wants to
     * archive the transaction log files
     * <p>
     * This is the default mode for GC.
     */
    public static final int GC_DISABLED = 0;

    /**
     * Synchronous gabrage collection is used to remove processed log files
     * when the last trnasaction, in that log file, has been successfully
     * processed. This is more efficient means since the log files does not
     * need to be scanned asynchronously to determine whether all the
     * transactions have been processed.
     */
    public static final int GC_SYNCHRONOUS = 1;

    /**
     * Asynchronous garbage collection is used to remove processed log files
     * asynchronous (i.e in a different thread context). This is rather
     * expensive since it must manually scan each log file and determine
     * whether all transactions, in that file, have been closed. If this is
     * the case then it will remove the log file.
     */
    public static final int GC_ASYNCHRONOUS = 2;

    /**
     * Maintains a singleton instance of the gc service
     */
    private static ResourceManager _instance = null;

    /**
     * Used to synchronize the creation of the transaction manager
     */
    private static final Object _initializer = new Object();

    /**
     * This is the maximum size, in bytes, of each transaction log file. The
     * value can be overriden by the user
     */
    private int _logFileSize = 1000000;

    /**
     * Maintains a collection of transaction log files currently in use by this
     * resource manager
     */
    private TreeSet _logs = new TreeSet(new TranLogFileComparator());

    /**
     * Maintain a mapping between the TRID (transaction id and the log file it
     * is associated with.
     */
    private HashMap _tridToLogCache = new HashMap();

    /**
     * Maintain a list of open TRIDs for a particular  {@link TransactionLog}
     */
    private HashMap _logToTridCache = new HashMap();

    /**
     * This attribute is used to synchronize the modifications to the _tridToLog
     * _logToTrid attributes
     */
    private final Object _cacheLock = new Object();

    /**
     * This maintains a cache of all open transactions and the corresponding
     * data. The key is the transaction identifier and the object is a LinkedList
     * transaction entries, which includes both state and data
     */
    private HashMap _activeTransactions = new HashMap();

    /**
     * The directory where the log files are stored. This can be set by the
     * client
     */
    private String _logDirectory = ".";

    /**
     * This is the number of the last log file created by the ResourceManager
     */
    private long _lastLogNumber = 0;

    /**
     * The expiry time for transaction associated with this resource manager.
     * This will either be configured or passed in with the transaction context
     * The value is specified in seconds.
     */
    private int _txExpiryTime = 120;

    /**
     * This attribute caches the garbage collection mode for the resouce
     * managers. Valid values are specified by the GC_* constants.
     * <p>
     * By default garbage collection is disabled.
     */
    private int _gcMode = GC_SYNCHRONOUS;

    /**
     * This is the id associated with this resource...need to work out who
     * or what sets this.
     */
    private String _rid = UUID.next();

    /**
     * The logger
     */
    private static final Log _log = LogFactory.getLog(ResourceManager.class);


    /**
     * Return the singleton instance of the ResourceManager
     *
     * @return ResourceManager
     * @throws ResourceManagerException
     */
    public static ResourceManager instance()
        throws ResourceManagerException {
        if (_instance == null) {
            synchronized (_initializer) {
                // we need to check again if multiple threads
                // have blocked on the creation of the singleton
                if (_instance == null) {
                    _instance = new ResourceManager();
                }
            }
        }

        return _instance;
    }

    /**
     * Construct a resource manager using the default directory for its log
     * files.
     * <p>
     * If there is a problem constructing this instances then throw a
     * {@link ResourceManagerException} exception.
     *
     * @throws ResourceManagerException
     */
    private ResourceManager()
        throws ResourceManagerException {

        // build the list of existing log files.
        this("./logs");
    }

    /**
     * Construct a resource manager using the specified directory, which
     * must already exist. If the directory does not exist or there is
     * no permisssion to access it then throw a ResourceManagerException
     *
     * @param dir - the base directory
     * @throws ResourceManagerException
     */
    public ResourceManager(String dir)
        throws ResourceManagerException {
        super(RM_SERVICE_NAME);
        _logDirectory = dir;
        File file = new File(dir);
        if ((!file.exists()) ||
            (!file.isDirectory())) {
            throw new ResourceManagerException(dir +
                " does not exist or is not a directory");
        }

        // build the list of existing log files.
        buildLogFileList();

        // recover te list of log files
        recover();
    }

    /**
     * Set the log directory. This is the directory where all the log files
     * are stored
     *
     * @param dir - the name of the directory (absolute or relative)
     * @throws IllegalArgumentException if the string is not a directory
     */
    public void setLogDirectory(String dir)
        throws IllegalArgumentException {
        if (!(new File(dir)).isDirectory()) {
            throw new IllegalArgumentException(dir + " is not a directory");
        } else {
            _logDirectory = dir;
        }
    }

    /**
     * Retrieve the name of the log directory
     *
     * @return String - log dir name
     */
    public String getLogDirectory() {
        return _logDirectory;
    }

    /**
     * Set the maximum size of each log file. When this size is reached a
     * new log file is created. The size of the log file can be changed
     * dynamically during runtime. If it is not specified it will default
     * to 1MB.
     * <p>
     * The size is specified in bytes
     *
     * @param size - the max size of each log file
     */
    public void setLogFileSize(int size) {
        _logFileSize = size;
    }

    /**
     * Return the maximum size that each log file can grow too.
     *
     * @return int - log file size
     */
    public int getLogFileSize() {
        return _logFileSize;
    }

    /**
     * Set the GC mode for the resource manager. Valid values are GC_SYNCHRONOUS,
     * GC_ASYNCHRONOUS and GC_DISABLED.
     * <p>
     * @param mode - one of GC_*
     * @return boolean - if the specified mode has been correctly set
     */
    public boolean setGCMode(int mode) {
        boolean result = false;

        if ((mode == GC_DISABLED) ||
            (mode == GC_SYNCHRONOUS) ||
            (mode == GC_ASYNCHRONOUS)) {
            _gcMode = mode;
            result = true;
        }

        return result;
    }

    /**
     * Return the garbage collection mode for the resource manager
     *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产剧情一区在线| 在线看不卡av| 欧美精品一卡两卡| 欧美激情在线看| 免费观看91视频大全| 一本色道**综合亚洲精品蜜桃冫| 日韩免费福利电影在线观看| 亚洲一线二线三线视频| 国产传媒欧美日韩成人| 日韩欧美一区二区免费| 一二三区精品视频| av电影在线观看一区| 久久一区二区视频| 三级久久三级久久| 色综合久久中文字幕| 国产欧美一区二区精品仙草咪 | 亚洲欧美激情一区二区| 精品中文av资源站在线观看| 欧美日韩在线不卡| 亚洲黄色小视频| 国产成a人亚洲精品| 精品久久久三级丝袜| 免费美女久久99| 欧美日韩免费高清一区色橹橹| 亚洲色图色小说| 国产宾馆实践打屁股91| 久久精品欧美日韩| 麻豆极品一区二区三区| 日韩欧美综合在线| 日本不卡123| 在线不卡a资源高清| 香蕉乱码成人久久天堂爱免费| 日韩一区二区精品在线观看| 亚洲综合在线电影| 色综合色狠狠综合色| 亚洲三级久久久| 色天使色偷偷av一区二区| 日韩理论片在线| 在线影视一区二区三区| 亚洲午夜一区二区三区| 678五月天丁香亚洲综合网| 亚洲成人av一区二区| 欧美顶级少妇做爰| 无吗不卡中文字幕| 666欧美在线视频| 蜜臀av国产精品久久久久| 日韩亚洲欧美在线| 国产真实乱子伦精品视频| 久久精品无码一区二区三区| 国产成人免费视频网站| 国产精品久久久久国产精品日日| eeuss鲁片一区二区三区| 亚洲男人的天堂网| 欧美日韩免费不卡视频一区二区三区| 天天影视涩香欲综合网| 日韩欧美中文字幕公布| 国产一区三区三区| 成人欧美一区二区三区在线播放| 在线观看免费成人| 日本不卡在线视频| 国产三级三级三级精品8ⅰ区| 97久久精品人人做人人爽50路| 夜色激情一区二区| 欧美不卡激情三级在线观看| 风间由美一区二区三区在线观看| 亚洲欧美视频在线观看视频| 欧美一区二区人人喊爽| 国产成人精品三级| 亚洲第一精品在线| 精品国产第一区二区三区观看体验| 国产宾馆实践打屁股91| 天堂一区二区在线免费观看| 国产精品无遮挡| 91精品国模一区二区三区| 岛国精品一区二区| 奇米影视一区二区三区| 亚洲欧美偷拍三级| 久久久久久影视| 欧美视频一区二区在线观看| 国产精品自在欧美一区| 亚洲电影视频在线| 国产精品亲子乱子伦xxxx裸| 91精品国产一区二区三区蜜臀| 成av人片一区二区| 美国av一区二区| 亚洲一区二区三区中文字幕在线| 国产女人18水真多18精品一级做| 777xxx欧美| 色狠狠桃花综合| 成人免费毛片a| 国产乱子轮精品视频| 午夜精品视频一区| 亚洲欧美日韩久久精品| 国产日产欧产精品推荐色| 欧美一级xxx| 欧美日韩亚洲国产综合| 精品乱码亚洲一区二区不卡| 在线观看日韩av先锋影音电影院| 成人妖精视频yjsp地址| 麻豆国产一区二区| 日本成人在线看| 婷婷久久综合九色综合绿巨人| 亚洲日本va在线观看| 国产欧美一区视频| 精品国产1区2区3区| 欧美一区二区三区免费观看视频| 91福利在线免费观看| 91麻豆福利精品推荐| 成人一区二区三区中文字幕| 国产精品一区二区三区乱码 | 成人欧美一区二区三区1314| 久久这里都是精品| www国产亚洲精品久久麻豆| 日韩一区二区三区视频| 91精品一区二区三区久久久久久| 在线观看av一区二区| 色久优优欧美色久优优| 91国产免费观看| 欧美色图在线观看| 欧美图区在线视频| 欧美日本精品一区二区三区| 国产一区二区成人久久免费影院| 国产中文一区二区三区| 国产成人综合自拍| www.亚洲色图| 91麻豆精品视频| 欧美日韩视频第一区| 91精品国产欧美日韩| 精品国产1区2区3区| 国产精品嫩草99a| 亚洲一区二区五区| 免费久久99精品国产| 久草精品在线观看| 岛国av在线一区| 91久久精品日日躁夜夜躁欧美| 欧美午夜精品久久久| 欧美人xxxx| 国产亚洲精久久久久久| 成人免费一区二区三区视频| 亚洲一区二区中文在线| 麻豆精品视频在线观看免费| 国产河南妇女毛片精品久久久| 不卡av在线网| 欧美精品久久久久久久多人混战 | 国产精品亚洲人在线观看| 99精品久久99久久久久| 欧美老女人在线| 久久久久久亚洲综合| 一区二区三区日韩| 狠狠色丁香婷综合久久| 99re热视频这里只精品| 精品久久久久香蕉网| 亚洲精品免费看| 韩国三级在线一区| 9久草视频在线视频精品| 91精品国产免费| 成人欧美一区二区三区小说| 老司机精品视频线观看86 | 欧美精品aⅴ在线视频| 国产欧美在线观看一区| 日韩精品一区第一页| eeuss鲁片一区二区三区| 日韩欧美国产麻豆| 中文字幕在线不卡一区| 麻豆久久久久久久| 色哟哟欧美精品| 国产欧美视频在线观看| 日本特黄久久久高潮| 欧美理论在线播放| 国产日产亚洲精品系列| 青青草97国产精品免费观看| 色婷婷av一区二区三区之一色屋| 欧美成人性战久久| 一区二区三区成人| 99综合电影在线视频| 久久一区二区视频| 精品在线亚洲视频| 91精品国产全国免费观看| 一区二区三区日韩| 91天堂素人约啪| 国产女同互慰高潮91漫画| 精品一区二区在线播放| 欧美人狂配大交3d怪物一区| 成人欧美一区二区三区| 国产精品91xxx| 久久久久久一二三区| 久久成人免费网| 7777精品伊人久久久大香线蕉经典版下载 | 91同城在线观看| 国产精品久久毛片av大全日韩| 激情文学综合插| 日韩一区二区电影在线| 亚洲成人你懂的| 欧美性大战久久久| 亚洲欧美色图小说| 91在线观看免费视频| 中文字幕一区二区三区乱码在线| 国产在线精品国自产拍免费| 亚洲九九爱视频| 91麻豆精品一区二区三区|