亚洲欧美第一页_禁久久精品乱码_粉嫩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一区精品变态类天堂 | 久久精品综合网| 欧美亚洲日本国产| 国产精品一区在线| 日韩精品乱码av一区二区| 中文字幕一区二区在线播放| 日韩免费看网站| 欧美性大战久久久| 成人aaaa免费全部观看| 激情综合网av| 日韩av中文字幕一区二区三区| 亚洲三级视频在线观看| 久久奇米777| 日韩精品中文字幕一区| 欧美色图片你懂的| av毛片久久久久**hd| 激情成人综合网| 青青草精品视频| 亚洲成a人在线观看| 综合激情成人伊人| 欧美激情中文字幕一区二区| 精品日韩在线观看| 91精品国产综合久久国产大片| 色老汉av一区二区三区| 99久久久久久99| 成人国产精品免费网站| 国产成人av一区| 国产黄人亚洲片| 国产精品69久久久久水密桃| 久久精品国内一区二区三区| 日本一区中文字幕| 午夜久久电影网| 婷婷国产v国产偷v亚洲高清| 亚洲韩国精品一区| 亚洲一区中文日韩| 亚洲女人小视频在线观看| 一区二区中文视频| 亚洲人快播电影网| 亚洲精品成人在线| 亚洲影院免费观看| 亚洲成人久久影院| 日韩在线观看一区二区| 三级欧美韩日大片在线看| 午夜久久久久久| 蜜臀久久99精品久久久久宅男| 蜜臀久久99精品久久久久宅男| 美女精品自拍一二三四| 卡一卡二国产精品| 国产精品18久久久| 成人h动漫精品一区二区| www.综合网.com| 色婷婷久久一区二区三区麻豆| 99re热这里只有精品视频| 91香蕉视频在线| 欧美日本在线播放| 欧美成人一区二区三区在线观看| 精品成人一区二区三区| 国产人妖乱国产精品人妖| 国产精品久久久久久久久动漫 | 欧美三级电影在线看| 欧美日韩国产区一| 精品国产自在久精品国产| www久久久久| 国产精品视频一二三区| 亚洲精品一二三四区| 亚洲va天堂va国产va久| 九九精品视频在线看| 成人在线视频首页| 欧美性感一区二区三区| 欧美大片在线观看| 国产精品国产三级国产有无不卡| 亚洲精品中文字幕乱码三区| 青青草成人在线观看| 粉嫩av一区二区三区| 欧美三级电影精品| 国产日韩欧美精品一区| 亚洲综合色噜噜狠狠| 国产在线精品国自产拍免费| 91原创在线视频| 欧美成人a∨高清免费观看| 欧美国产日韩一二三区| 天天综合日日夜夜精品| 国产高清亚洲一区| 欧美日韩成人在线一区| 欧美激情在线看| 视频一区在线播放| 大陆成人av片| 日韩一级片在线观看| 亚洲欧美在线视频观看| 免费高清在线视频一区·| 99热99精品| 欧美电视剧在线看免费| 亚洲伊人色欲综合网| 国产精品亚洲午夜一区二区三区 | 91精品国产麻豆| 国产精品美女久久久久久久网站| 人人狠狠综合久久亚洲| 95精品视频在线| 日韩精品最新网址| 亚洲在线中文字幕| 成人国产精品免费网站| 精品99999| 五月婷婷久久丁香| av电影在线不卡| 久久一区二区视频| 爽好多水快深点欧美视频| 色综合色综合色综合色综合色综合| 精品对白一区国产伦| 午夜精品久久久久久久99水蜜桃 | 91福利社在线观看| 国产精品欧美一区二区三区| 九九九久久久精品| 欧美高清性hdvideosex| 伊人色综合久久天天| 国产福利一区在线观看| 日韩一区二区免费电影| 亚洲成a人片综合在线| 色婷婷国产精品| 国产精品传媒入口麻豆| 国产成人综合网| 精品日韩av一区二区| 日韩福利电影在线观看| 精品婷婷伊人一区三区三| 亚洲乱码国产乱码精品精小说| 成人三级在线视频| 国产色产综合产在线视频| 韩日av一区二区| 精品日韩在线观看| 激情都市一区二区| 久久久99精品免费观看不卡| 国模冰冰炮一区二区| 2023国产一二三区日本精品2022| 久久精品国产久精国产| 精品日本一线二线三线不卡| 精品在线观看免费| 精品国产百合女同互慰| 国产一区在线看| 国产亚洲污的网站| 成人天堂资源www在线| 18涩涩午夜精品.www| 91美女蜜桃在线| 依依成人综合视频| 欧美军同video69gay| 日韩中文字幕麻豆| 日韩美女视频在线| 粉嫩aⅴ一区二区三区四区五区| 国产情人综合久久777777| 成人av资源网站| 亚洲视频在线一区观看| 日本道精品一区二区三区| 亚洲一二三四区| 欧美丰满少妇xxxbbb| 国产在线播精品第三| 国产精品全国免费观看高清| 日本韩国欧美在线| 三级精品在线观看| 久久久久久久久蜜桃| 99re这里只有精品6| 亚洲自拍偷拍麻豆| 日韩美女一区二区三区| 丁香一区二区三区| 亚洲黄色av一区| 欧美一区二区三区在线看| 狠狠色综合日日| 国产精品国产三级国产aⅴ入口 | 欧美国产一区在线| 欧美熟乱第一页| 蜜臀av性久久久久蜜臀av麻豆| 久久精品一区二区三区不卡 | 精品一区二区三区免费| 国产精品系列在线| 欧美性大战xxxxx久久久| 精品系列免费在线观看| 亚洲欧洲一区二区三区| 欧美高清一级片在线| 成人毛片视频在线观看| 亚洲成人免费视频| 久久久99免费| 欧美视频日韩视频| 国产成人av电影在线| 亚洲第一精品在线| 国产欧美一区二区精品忘忧草| 91电影在线观看| 黑人巨大精品欧美黑白配亚洲| 亚洲精品成人悠悠色影视| 久久综合久久综合亚洲| 在线免费视频一区二区| 国产精品影视在线| 午夜激情一区二区三区| 国产精品久久久久永久免费观看| 日韩精品中文字幕在线一区| 一本色道久久综合亚洲91|