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

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

?? destinationmanager.java

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

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Vector;
import javax.jms.InvalidDestinationException;
import javax.jms.JMSException;
import javax.naming.Context;
import javax.naming.NamingException;

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

import org.exolab.jms.client.JmsDestination;
import org.exolab.jms.client.JmsQueue;
import org.exolab.jms.client.JmsTopic;
import org.exolab.jms.config.AdministeredDestinations;
import org.exolab.jms.config.AdministeredQueue;
import org.exolab.jms.config.AdministeredTopic;
import org.exolab.jms.config.ConfigurationManager;
import org.exolab.jms.config.Subscriber;
import org.exolab.jms.gc.GarbageCollectable;
import org.exolab.jms.gc.GarbageCollectionService;
import org.exolab.jms.message.MessageImpl;
import org.exolab.jms.persistence.DatabaseService;
import org.exolab.jms.persistence.PersistenceAdapter;
import org.exolab.jms.persistence.PersistenceException;
import org.exolab.jms.persistence.SQLHelper;
import org.exolab.jms.server.NamingHelper;
import org.exolab.jms.service.ServiceException;


/**
 * The destination manager is responsible for creating and managing the
 * lifecycle of {@link DestinationCache} objects. The destination manager is
 * also responsible for managing messages, that are received by the message
 * manager, which do not have any registered {@link DestinationCache}
 *
 * @author <a href="mailto:jima@comware.com.au">Jim Alateras</a>
 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 * @version $Revision: 1.2 $ $Date: 2005/03/18 03:58:39 $
 */
public class DestinationManager
        implements MessageManagerEventListener, GarbageCollectable {

    /**
     * This structure maintains a list of active caches.
     */
    private Map _caches = Collections.synchronizedMap(new HashMap());

    /**
     * The set of persistent and non-persistent destinations, keyed on name.
     */
    private HashMap _destinationCache = new HashMap();

    /**
     * Maintains a list of wildcard destinations, which can either be durable or
     * transient.
     */
    private LinkedList _wildcardDestinations = new LinkedList();

    /**
     * Maintains a linked list of DestinationEventListener objects. These
     * listeners will be informed when destinations are added or destroyed.
     */
    private LinkedList _listeners = new LinkedList();

    /**
     * Manage the singleton instance of the DestinationManager.
     */
    private static volatile DestinationManager _instance = null;

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

    /**
     * Construct a new <code>DestinationManager</code>.
     *
     * @throws ServiceException if the service cannot be initialised
     */
    private DestinationManager() throws ServiceException {
        init();

        // register with the GarbageCollectionService
        GarbageCollectionService.instance().register(this);
    }

    /**
     * Create the singleton instance of the destination manager.
     *
     * @return the singleton instance
     * @throws ServiceException if the service cannot be initialised
     */
    public static DestinationManager createInstance() throws ServiceException {
        _instance = new DestinationManager();
        return _instance;
    }

    /**
     * Return the singleton destination manager.
     *
     * @return the singleton instance, or <code>null</code> if it hasn't been
     *         initialised
     */
    public static DestinationManager instance() {
        return _instance;
    }

    /**
     * Returns the cache for the supplied destination. If the cache doesn't
     * exist, it will be created, and any listeners notified.
     *
     * @param dest the destination of the cache to return
     * @return the cache associated with <code>dest</code>
     * @throws InvalidDestinationException if <code>dest</code> doesn't exist
     * @throws JMSException                if the cache can't be created
     */
    public DestinationCache getDestinationCache(JmsDestination dest)
            throws JMSException {
        DestinationCache result;
        try {
            result = getDestinationCache(dest, null);
        } catch (PersistenceException exception) {
            String msg = "Failed to create cache for destination "
                    + dest.getName();
            _log.error(msg, exception);
            throw new JMSException(msg + ": " + exception.getMessage());
        }
        return result;
    }

    /**
     * Returns the cache for the supplied destination. If the cache doesn't
     * exist, it will be created, and any listeners notified.
     *
     * @param dest the destination of the cache to return
     * @return the cache associated with <code>dest</code>
     * @throws InvalidDestinationException if <code>dest</code> doesn't exist
     * @throws JMSException                if the cache can't be created
     * @throws PersistenceException        for any persistence error
     */
    public synchronized DestinationCache getDestinationCache(
            JmsDestination dest, Connection connection) throws JMSException,
            PersistenceException {
        DestinationCache result = (DestinationCache) _caches.get(dest);
        if (result == null) {
            if (dest instanceof JmsTopic && ((JmsTopic) dest).isWildCard()) {
                throw new InvalidDestinationException(
                        "Cannot cache messages for wildcarded topic: "
                        + dest.getName());
            }

            JmsDestination existing = getDestination(dest.getName());
            if (existing == null) {
                throw new InvalidDestinationException(
                        "Destination does not exist: " + dest.getName());
            }
            if (existing.getPersistent()) {
                if (connection != null) {
                    result = createPersistentCache(existing, connection);
                } else {
                    result = createPersistentCache(existing);
                }
            } else {
                result = createNonPersistentCache(existing);
            }
            _caches.put(dest, result);

            // notify the listeners that a new destination has been added
            // to the destination manager
            notifyDestinationAdded(dest, result);
        }
        return result;
    }

    /**
     * Create a persistent {@link DestinationCache} for the specified
     * destination.
     *
     * @param dest       the destination to create the cache for
     * @param connection the database connection to use
     * @return a new cache
     * @throws JMSException         for any JMS error
     * @throws PersistenceException for any persistence error
     */
    protected DestinationCache createPersistentCache(JmsDestination dest,
                                                     Connection connection)
            throws JMSException, PersistenceException {

        DestinationCache result;
        if (dest instanceof JmsTopic) {
            result = new TopicDestinationCache((JmsTopic) dest, connection);
        } else {
            result = new QueueDestinationCache((JmsQueue) dest, connection);
        }
        return result;
    }

    /**
     * Create a persistent {@link DestinationCache} for the specified
     * destination.
     *
     * @param dest the destination to create the cache for
     * @return a new cache
     * @throws JMSException         if the cache cannot be created
     * @throws PersistenceException for any persistence error
     */
    protected DestinationCache createPersistentCache(JmsDestination dest)
            throws JMSException, PersistenceException {

        DestinationCache result;
        Connection connection = null;
        try {

            connection = DatabaseService.getConnection();
            result = createPersistentCache(dest, connection);
            connection.commit();
        } catch (JMSException exception) {
            SQLHelper.rollback(connection);
            throw exception;
        } catch (SQLException exception) {
            SQLHelper.rollback(connection);
            throw new PersistenceException(exception);
        } finally {
            SQLHelper.close(connection);
        }

        return result;
    }

    /**
     * Create a non-persistent {@link DestinationCache} for the specified
     * destination.
     *
     * @param dest the destination to create the cache for
     * @return a new cache
     * @throws JMSException if the cache cannot be created
     */
    protected DestinationCache createNonPersistentCache(JmsDestination dest)
            throws JMSException {

        DestinationCache result;
        if (dest instanceof JmsTopic) {
            result = new TopicDestinationCache((JmsTopic) dest);
        } else {
            result = new QueueDestinationCache((JmsQueue) dest);
        }

        // notify the listeners that a new destination has been added
        // to the destination manager
        notifyDestinationAdded(dest, result);
        _caches.put(dest, result);

        return result;
    }

    /**
     * Delete the specfied destination.
     *
     * @param cache the destination to destroy
     */
    protected void destroyDestinationCache(DestinationCache cache) {
        destroyDestinationCache(cache.getDestination());

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www久久精品| 日本 国产 欧美色综合| 丝瓜av网站精品一区二区| 国产精品一区二区黑丝| 欧美日韩精品欧美日韩精品| 欧美激情综合五月色丁香| 久久国产综合精品| 欧美日韩精品一二三区| 亚洲男人的天堂在线aⅴ视频| 国产一区二区精品久久99| 欧美一区中文字幕| 亚洲成人综合网站| 色综合久久久久久久久| 2024国产精品| 久久精品噜噜噜成人av农村| 精品视频一区二区不卡| 亚洲精品视频免费看| 波多野结衣精品在线| 国产亚洲精品久| 国产一区欧美日韩| 精品国产乱码久久久久久闺蜜| 午夜欧美在线一二页| 欧美系列亚洲系列| 亚洲风情在线资源站| 欧美在线综合视频| 亚洲高清中文字幕| 欧美午夜片在线看| 亚洲成人综合在线| 欧美精品视频www在线观看| 亚洲一区二区视频在线观看| 在线一区二区三区四区五区 | 97精品国产露脸对白| 久久久青草青青国产亚洲免观| 毛片av中文字幕一区二区| 欧美一区二区三区系列电影| 秋霞av亚洲一区二区三| 精品粉嫩aⅴ一区二区三区四区| 日韩av网站免费在线| 精品久久久久香蕉网| 国内外成人在线视频| 日本一区二区不卡视频| 99久久久国产精品免费蜜臀| 亚洲精品免费在线观看| 欧美日韩国产一级片| 捆绑调教美女网站视频一区| 久久综合av免费| 不卡av在线网| 亚洲亚洲人成综合网络| 欧美一区日本一区韩国一区| 看片的网站亚洲| 国产女人水真多18毛片18精品视频| 成人听书哪个软件好| 亚洲在线观看免费| 欧美一区二区不卡视频| 国产成人av电影免费在线观看| 中文字幕一区三区| 欧美日韩日本视频| 韩国女主播一区| 亚洲视频免费在线| 91精品国产欧美一区二区18| 国模套图日韩精品一区二区 | 99久久免费国产| 午夜欧美2019年伦理| 国产亚洲精品精华液| 日本道色综合久久| 国内精品写真在线观看| 亚洲精品视频在线看| 欧美大片免费久久精品三p| 91精品国产欧美一区二区| 精品一区二区三区在线观看国产| 久久精品夜色噜噜亚洲aⅴ| 欧美在线你懂的| 国产一区 二区 三区一级| 一区二区三区四区在线播放| 日韩一区二区在线免费观看| eeuss影院一区二区三区 | 一区二区三区四区国产精品| 91精品国产综合久久久久| 99精品在线观看视频| 韩国精品在线观看| 亚洲国产精品视频| 综合激情成人伊人| 久久久综合视频| 欧美精品vⅰdeose4hd| 不卡高清视频专区| 国产美女一区二区三区| 青青草国产精品97视觉盛宴| 樱花草国产18久久久久| 久久久久国产精品麻豆ai换脸 | 色婷婷激情一区二区三区| 国产一区二区美女| 麻豆freexxxx性91精品| 亚洲国产aⅴ成人精品无吗| 综合欧美一区二区三区| 中文字幕精品在线不卡| 久久综合狠狠综合| 精品处破学生在线二十三| 欧美精品vⅰdeose4hd| 91极品美女在线| 色综合色综合色综合| 成人午夜电影网站| 成人性生交大片免费看视频在线 | 亚洲精品国产成人久久av盗摄| 久久九九影视网| 欧美精品一区二区三区很污很色的| 欧美日本在线一区| 欧美午夜精品一区| 欧美色图片你懂的| 欧美人与禽zozo性伦| 欧美在线高清视频| 欧美日韩一区不卡| 欧美日韩国产综合视频在线观看 | 日韩一区精品字幕| 亚洲.国产.中文慕字在线| 夜夜嗨av一区二区三区四季av| 亚洲色图一区二区| 一区二区三区在线观看网站| 一区二区免费视频| 亚洲精品福利视频网站| 亚洲国产另类av| 日本女人一区二区三区| 蜜臂av日日欢夜夜爽一区| 久久69国产一区二区蜜臀| 极品少妇xxxx精品少妇偷拍| 国产麻豆91精品| 成人黄色av电影| 色婷婷一区二区| 欧美精品少妇一区二区三区| 日韩欧美成人一区二区| 久久婷婷成人综合色| 国产精品免费aⅴ片在线观看| 亚洲色图制服诱惑| 天堂久久一区二区三区| 国产一区二区h| 91网址在线看| 91精品国产综合久久福利| 26uuu另类欧美| 日韩美女久久久| 日本伊人精品一区二区三区观看方式 | 成人网页在线观看| 色综合久久中文字幕| 欧美一区二区三区四区五区| 久久久久久久久久久电影| 亚洲自拍都市欧美小说| 精品一区二区三区免费观看| 99国产精品久久| 日韩精品中文字幕一区二区三区 | 91精品国产一区二区三区 | 视频在线在亚洲| 国产精品综合二区| 欧美午夜电影网| 国产女主播一区| 视频在线观看一区二区三区| 丰满少妇在线播放bd日韩电影| 欧美午夜精品久久久久久孕妇 | 国产一区二区三区美女| 色综合天天综合给合国产| 欧美一区在线视频| 日韩一区在线免费观看| 狠狠色狠狠色综合日日91app| 色老汉av一区二区三区| 久久嫩草精品久久久久| 亚洲小少妇裸体bbw| 欧美日韩精品一区二区天天拍小说| 久久精品一区二区三区不卡| 亚洲二区在线视频| 91在线精品一区二区三区| 精品成人一区二区三区四区| 亚洲国产视频在线| 9人人澡人人爽人人精品| 精品免费日韩av| 日韩国产欧美三级| 欧美在线一二三| 亚洲欧美日韩国产另类专区| 国产精品亚洲视频| 精品国产三级a在线观看| 亚洲国产成人av网| 欧美综合欧美视频| 亚洲精选视频免费看| 成人午夜视频网站| 久久精品一区二区三区不卡| 紧缚捆绑精品一区二区| 欧美精品三级在线观看| 亚洲黄色小视频| av网站免费线看精品| 国产精品麻豆一区二区| 成人午夜激情在线| 国产亚洲欧美激情| 国产一区二区伦理| 国产亚洲人成网站| 国产一区二区福利视频| 久久精品一区二区三区四区| 国产一区91精品张津瑜| 久久视频一区二区| 国产乱码一区二区三区| 中文字幕二三区不卡| www.日韩大片| 中文字幕字幕中文在线中不卡视频| 99re热这里只有精品视频| 日韩理论片中文av|