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

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

?? batchingrdbmsadapter.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * 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 2002-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: BatchingRdbmsAdapter.java,v 1.2 2005/03/18 04:05:52 tanderson Exp $
 */
package org.exolab.jms.persistence;


import java.sql.Connection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Vector;

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

import org.exolab.jms.authentication.User;
import org.exolab.jms.client.JmsDestination;
import org.exolab.jms.events.EventHandler;
import org.exolab.jms.message.MessageId;
import org.exolab.jms.message.MessageImpl;
import org.exolab.jms.messagemgr.MessageHandle;


/**
 * The batching RDBMS adapter is used to improve the performance of persistent
 * messages by batching more instructions into a single transaction.
 * <p>
 * It encpasulates an {@link RDBMSAdapter} and delegates all the behaviour to
 * it. In the interim it will only batch 'insert', 'update' and 'delete'
 * statements. If it receives a 'select' or any query it will first commit the
 * batched statements before satisfying the query.
 * <p>
 * This piece of code is still under development and could effect the integrity
 * of your system if used. It could also improve the throughput of persistent
 * messages if it works correctly.
 *
 * @version     $Revision: 1.2 $ $Date: 2005/03/18 04:05:52 $
 * @author      <a href="mailto:jima@intalio.org">Jim Alateras</a>
 */
public class BatchingRdbmsAdapter
    extends PersistenceAdapter
    implements EventHandler {

    /**
     * This is the maximum number of statements that can be batched before
     * actually committing the work to the database. This value defaults to
     * 100 but it can be changed at runtime.
     */
    private int _maxStatementsToBatch = 500;

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

    /**
     *  Holds a reference to the RDBMSAdapter, which it delegates all the
     * work too.
     */
    private RDBMSAdapter _rdbms = null;

    /**
     * Holds the current batch of trnasactional objects.
     */
    private LinkedList _batch = new LinkedList();

    /**
     * Holds a reference to message handles that have been batched up.
     */
    private HashMap _handles = new HashMap();

    /**
     * Holds a reference to messages that have been batched up
     */
    private HashMap _messages = new HashMap();

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


    /**
     * Connects to the given db.
     *
     * @param driver - the rdbms driver to use
     * @param url - the url to the database
     * @param userName - a valid user name for a connection to the database
     * @param password - the password for the connection to the database
     * @param batchSize - the number of requests it should batch
     * @throws PersistenceException for any database error
     */
    BatchingRdbmsAdapter(String driver, String url, String userName,
                         String password, int batchSize)
        throws PersistenceException {
        // create the rdbms adapter
        _rdbms = new RDBMSAdapter(driver, url, userName, password);
        _maxStatementsToBatch = batchSize;
    }

    /**
     * Close the database if open.
     *
     */
    public void close() {
        if (_rdbms != null) {
            try {
                flush();
            } catch (PersistenceException exception) {
                _log.error("Failed to flush statements", exception);
            }
            _rdbms.close();
        }
    }

    /**
     * Set the maximum number of SQL statements to batch
     *
     * @param max - number of statements to batch
     */
    public void setMaxStatementsToBatch(int max) {
        _maxStatementsToBatch = max;
    }

    /**
     * Return the maximum number of statements to batch
     *
     * @return int
     */
    public int getMaxStatementsToBatch() {
        return _maxStatementsToBatch;
    }

    // implementation of PersistenceAdapter.getLastId
    public long getLastId(Connection connection)
        throws PersistenceException {
        return _rdbms.getLastId(connection);
    }

    // implementation of PersistenceAdapter.updateIds
    public void updateIds(Connection connection, long id)
        throws PersistenceException {
        _rdbms.updateIds(connection, id);
    }

    // implementation of PersistenceMessage.addMessage
    public void addMessage(Connection connection, MessageImpl message)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.ADD_MESSAGE, message);
    }

    // implementation of PersistenceMessage.addMessage
    public void updateMessage(Connection connection, MessageImpl message)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.UPDATE_MESSAGE, message);
    }

    // implementation of PersistenceAdapter.getUnprocessedMessages
    public Vector getUnprocessedMessages(Connection connection)
        throws PersistenceException {
        flush();
        return _rdbms.getUnprocessedMessages(connection);
    }


    // implementation of PersistenceAdapter.removeMessage
    public void removeMessage(Connection connection, String id)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.DELETE_MESSAGE, id);
    }

    // implementation of PersistenceAdapter.getMessage
    public MessageImpl getMessage(Connection connection, String id)
        throws PersistenceException {
        flush();
        return _rdbms.getMessage(connection, id);
    }

    // implementation of PersistenceAdapter.getMessages
    public Vector getMessages(Connection connection,
                              MessageHandle handle)
        throws PersistenceException {
        flush();
        return _rdbms.getMessages(connection, handle);
    }

    // implementation of PersistenceAdapter.addMessageHandle
    public void addMessageHandle(Connection connection,
                                 MessageHandle handle)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.ADD_HANDLE, handle);
    }

    // implementation of PersistenceAdapter.updateMessageHandle
    public void updateMessageHandle(Connection connection,
                                    MessageHandle handle)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.UPDATE_HANDLE, handle);
    }

    // implementation of PersistenceAdapter.removeMessageHandle
    public void removeMessageHandle(Connection connection,
                                    MessageHandle handle)
        throws PersistenceException {
        addToBatch(TransactionalObjectWrapper.DELETE_HANDLE, handle);
    }

    // implementation of PersistenceAdapter.getMessageHandles
    public Vector getMessageHandles(Connection connection,
                                    JmsDestination destination, String name)
        throws PersistenceException {
        flush();
        return _rdbms.getMessageHandles(connection, destination, name);
    }

    // implementation of PersistenceAdapter.addDurableConsumer
    public void addDurableConsumer(Connection connection, String topic,
                                   String consumer)
        throws PersistenceException {
        flush();
        _rdbms.addDurableConsumer(connection, topic, consumer);
    }

    // implementation of PersistenceAdapter.removeDurableConsumer
    public void removeDurableConsumer(Connection connection, String consumer)
        throws PersistenceException {
        flush();
        _rdbms.removeDurableConsumer(connection, consumer);
    }

    // implementation of PersistenceAdapter.getDurableConsumers
    public Enumeration getDurableConsumers(Connection connection,
                                           String topic)
        throws PersistenceException {
        flush();
        return _rdbms.getDurableConsumers(connection, topic);
    }

    // implementation of PersistenceAdapter.getAllDurableConsumers
    public HashMap getAllDurableConsumers(Connection connection)
        throws PersistenceException {
        flush();
        return _rdbms.getAllDurableConsumers(connection);
    }

    // implementation of PersistenceAdapter.durableConsumerExists
    public boolean durableConsumerExists(Connection connection, String name)
        throws PersistenceException {
        flush();
        return _rdbms.durableConsumerExists(connection, name);
    }

    // implementation of PersistenceAdapter.addDestination
    public void addDestination(Connection connection, String name,
                               boolean queue)
        throws PersistenceException {
        flush();
        _rdbms.addDestination(connection, name, queue);
    }

    // implementation of PersistenceAdapter.removeDestination
    public void removeDestination(Connection connection, String name)
        throws PersistenceException {
        flush();
        _rdbms.removeDestination(connection, name);
    }

    // implementation of PersistenceAdapter.getAllDestinations
    public Enumeration getAllDestinations(Connection connection)
        throws PersistenceException {
        flush();
        return _rdbms.getAllDestinations(connection);
    }

    // implementation of PersistenceAdapter.checkDestination
    public boolean checkDestination(Connection connection, String name)
        throws PersistenceException {
        flush();
        return _rdbms.checkDestination(connection, name);
    }

    // implementation of getQueueMessageCount
    public int getQueueMessageCount(Connection connection, String name)
        throws PersistenceException {
        flush();
        return _rdbms.getQueueMessageCount(connection, name);
    }

    // implementation of PersistenceAdapter.getQueueMessageCount
    public int getDurableConsumerMessageCount(Connection connection,
                                              String destination, String name)
        throws PersistenceException {
        flush();
        return _rdbms.getDurableConsumerMessageCount(connection, destination,
            name);
    }

    // implementation of PersistenceAdapter.getQueueMessageCount
    public void removeExpiredMessages(Connection connection)
        throws PersistenceException {
        flush();
        _rdbms.removeExpiredMessages(connection);
    }

    // implementation of PersistenceAdapter.removeExpiredMessageHandles
    public void removeExpiredMessageHandles(Connection connection,
                                            String consumer)
        throws PersistenceException {
        flush();
        _rdbms.removeExpiredMessageHandles(connection, consumer);
    }

    // implementation of PersistenceAdapter.getQueueMessageCount
    public Vector getNonExpiredMessages(Connection connection,
                                        JmsDestination destination)
        throws PersistenceException {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
高清不卡在线观看| 激情丁香综合五月| 国产精品嫩草影院com| 久久亚洲综合色| 国产三级三级三级精品8ⅰ区| 日韩欧美国产电影| 欧美变态tickling挠脚心| 欧美成人性战久久| 久久综合九色综合97_久久久| 久久九九99视频| 一色桃子久久精品亚洲| 一区二区三区视频在线看| 亚洲资源在线观看| 久久国产精品第一页| 国产一区二区三区日韩| 99视频一区二区| 欧美日韩视频一区二区| 日韩美女视频在线| 欧美激情在线看| 亚洲天堂免费看| 日韩成人一区二区三区在线观看| 麻豆一区二区在线| 国产成人精品1024| 欧美揉bbbbb揉bbbbb| 精品福利在线导航| 日韩美女精品在线| 蜜臀精品久久久久久蜜臀| 国产成人在线色| 91福利资源站| 久久久久一区二区三区四区| 亚洲免费毛片网站| 国内国产精品久久| 欧美亚洲综合久久| 久久五月婷婷丁香社区| 一个色妞综合视频在线观看| 极品销魂美女一区二区三区| 91麻豆免费看| 26uuu国产在线精品一区二区| 亚洲人妖av一区二区| 毛片av一区二区三区| 91美女蜜桃在线| 国产日韩欧美一区二区三区综合| 午夜在线电影亚洲一区| 成人久久18免费网站麻豆 | 一区二区三区在线观看视频| 日韩制服丝袜av| 99免费精品在线观看| 26uuu色噜噜精品一区| 亚洲成av人在线观看| av一区二区三区黑人| 亚洲精品一区二区三区香蕉| 午夜精品久久久久久久蜜桃app| 国产不卡视频一区二区三区| 欧美一区二区视频在线观看| 亚洲午夜在线电影| 不卡的av在线| 中文字幕欧美三区| 国产成人精品三级麻豆| 久久新电视剧免费观看| 青草av.久久免费一区| 欧美日韩国产三级| 亚洲精品视频免费看| 成人av动漫网站| 欧美激情综合在线| 成人听书哪个软件好| 中文字幕不卡一区| 国产不卡视频在线观看| 久久久久久久电影| 高清国产一区二区| 国产精品毛片久久久久久久| 成人综合日日夜夜| 国产欧美日韩激情| 成人爱爱电影网址| 日韩理论在线观看| 日本二三区不卡| 亚洲1区2区3区视频| 欧美日本视频在线| 免费久久99精品国产| 欧美va亚洲va| 国产精品99久久久久久久女警 | 久久精品国产亚洲a| 日韩一区二区在线看片| 蜜桃av噜噜一区| 精品福利在线导航| 丰满白嫩尤物一区二区| 日韩伦理av电影| 91传媒视频在线播放| 日韩电影网1区2区| 欧美xxxxx牲另类人与| 国产成人免费视频一区| 中文字幕亚洲成人| 欧美日韩视频专区在线播放| 久久精品国产久精国产| 久久精品一区二区三区不卡牛牛 | 国产一区二区三区蝌蚪| 国产天堂亚洲国产碰碰| www.亚洲人| 亚洲成人精品一区二区| 欧美精品一区二区三区久久久| 国产麻豆日韩欧美久久| 一区二区三区久久久| 日韩精品一区二区三区视频播放 | 美女久久久精品| 国产精品欧美综合在线| 在线精品视频免费播放| 久久aⅴ国产欧美74aaa| 亚洲精品一二三| 精品卡一卡二卡三卡四在线| 91免费精品国自产拍在线不卡| 午夜视频在线观看一区二区| 欧美激情综合在线| 欧美一区二区三区日韩视频| 成人免费毛片app| 日韩高清一级片| 亚洲天堂精品视频| 久久天堂av综合合色蜜桃网| 欧美午夜精品理论片a级按摩| 国产毛片精品一区| 午夜久久久久久久久| 中文字幕亚洲区| www日韩大片| 欧美日韩一区成人| eeuss鲁一区二区三区| 久久99精品久久久久久国产越南| 亚洲美女电影在线| 国产视频一区二区在线观看| 51久久夜色精品国产麻豆| 成人午夜激情在线| 国产精品亚洲视频| 久久99久久精品欧美| 日韩电影在线免费| 亚洲国产毛片aaaaa无费看 | 884aa四虎影成人精品一区| 99九九99九九九视频精品| 国产成人免费在线观看| 国产一区二区视频在线| 日本视频免费一区| 午夜精品免费在线| 午夜亚洲福利老司机| 亚洲3atv精品一区二区三区| 亚洲一区二区三区在线| 亚洲精品国产a久久久久久| 亚洲日本在线天堂| 国产精品三级电影| 欧美高清在线一区| 日本一区二区视频在线观看| 国产日韩欧美激情| 国产调教视频一区| 国产精品国产馆在线真实露脸| 中文字幕欧美区| 国产精品每日更新在线播放网址| 国产精品婷婷午夜在线观看| 久久久久久久av麻豆果冻| 久久伊人蜜桃av一区二区| 欧美成人官网二区| 26uuu成人网一区二区三区| 久久嫩草精品久久久久| 国产精品欧美极品| 国产精品视频一二三| 亚洲免费观看高清完整版在线观看熊 | 高清beeg欧美| 99久久综合狠狠综合久久| 色综合久久综合网| 欧美日韩在线综合| 日韩欧美在线123| 久久综合九色综合97婷婷| 国产精品成人一区二区艾草| 亚洲综合视频在线观看| 午夜国产不卡在线观看视频| 麻豆视频一区二区| 成人免费毛片片v| 欧美亚日韩国产aⅴ精品中极品| 91麻豆精品国产91久久久久| 日韩欧美不卡在线观看视频| 国产精品萝li| 丝袜诱惑制服诱惑色一区在线观看| 麻豆精品一区二区| 国产精品99久久久久久有的能看| 97成人超碰视| 日韩一区二区麻豆国产| 一色屋精品亚洲香蕉网站| 丝袜美腿成人在线| 成人午夜碰碰视频| 777色狠狠一区二区三区| 欧美国产日韩在线观看| 亚洲午夜羞羞片| 国产精品资源站在线| 欧美色爱综合网| 国产欧美日韩精品一区| 午夜精品123| 92精品国产成人观看免费| 欧美电影影音先锋| 国产精品伦理一区二区| 久久精品99久久久| 在线视频欧美精品| 国产三级欧美三级日产三级99| 偷拍一区二区三区四区| 成人午夜电影小说| 欧美mv日韩mv| 亚洲成人在线免费|