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

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

?? queuedestinationcache.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
     * @param handle the message handle to return
     */
    public void returnMessageHandle(MessageHandle handle) {
        // add the message to the destination cache
        _handles.add(handle);

        // if there are registered consumers then check whether
        // any of them have registered message listeners
        ConsumerEndpoint[] consumers = getConsumerArray();
        final int size = consumers.length;
        if (size > 0) {
            // roll over the consumer index if it is greater
            // than the number of registered consumers
            if ((_lastConsumerIndex + 1) > size) {
                _lastConsumerIndex = 0;
            }

            int index = (_lastConsumerIndex >= size) ? 0 : _lastConsumerIndex;

            do {
                QueueConsumerEndpoint endpoint
                        = (QueueConsumerEndpoint) consumers[index];

                if (endpoint.hasMessageListener()) {
                    // if we find an endpoint with a listener then
                    // we should reschedule it.
                    endpoint.schedule();
                    _lastConsumerIndex = ++index;
                    break;
                } else if (endpoint.isWaitingForMessage()) {
                    endpoint.notifyMessageAvailable();
                    _lastConsumerIndex = ++index;
                    break;
                }

                // advance to the next consumer
                if (++index >= size) {
                    index = 0;
                }
            } while (index != _lastConsumerIndex);
        }
    }

    /**
     * Determines if there are any registered consumers.
     *
     * @return <code>true</code> if there are registered consumers
     */
    public boolean hasActiveConsumers() {
        boolean active = super.hasActiveConsumers();
        if (!active && !_browsers.isEmpty()) {
            active = true;
        }
        if (_log.isDebugEnabled()) {
            _log.debug("hasActiveConsumers()[queue=" + getDestination() + "]="
                       + active);
        }
        return active;
    }

    /**
     * Determines if this cache can be destroyed.
     * A <code>QueueDestinationCache</code> can be destroyed if there are no
     * active consumers and:
     * <ul>
     *   <li>the queue is persistent and there are no messages</li>
     *   <li> the queue is temporary and the corresponding connection is closed
     *   </li>
     * </ul>
     *
     * @return <code>true</code> if the cache can be destroyed, otherwise
     *         <code>false</code>
     */
    public boolean canDestroy() {
        boolean destroy = false;
        if (!hasActiveConsumers()) {
            JmsDestination queue = getDestination();
            if (queue.getPersistent() && getMessageCount() == 0) {
                destroy = true;
            } else if (queue.isTemporaryDestination()) {
                // check if there is a corresponding connection. If
                // not, it has been closed, and the cache can be removed
                long connectionId =
                        ((JmsTemporaryDestination) queue).getConnectionId();
                JmsServerConnectionManager manager =
                        JmsServerConnectionManager.instance();
                if (manager.getConnection(connectionId) == null) {
                    destroy = true;
                }
            }
        }
        return destroy;
    }

    /**
     * Destroy this object
     */
    public synchronized void destroy() {
        super.destroy();
        _browsers.clear();
    }

    /**
     * Initialise the cache. This removes all the expired messages, and then
     * retrieves all unacked messages from the database and stores them
     * locally.
     *
     * @param connection the database connection
     * @throws JMSException for any JMS error
     * @throws PersistenceException for any persistence error
     */
    protected void init(Connection connection) throws JMSException, PersistenceException {
        _handles = new MessageQueue();

        JmsDestination queue = getDestination();
        DatabaseService.getAdapter().removeExpiredMessageHandles(connection,
                                                                 queue.getName());
        DefaultMessageCache cache = getMessageCache();
        List handles = DatabaseService.getAdapter().getMessageHandles(
                connection, queue, queue.getName());
        Iterator iterator = handles.iterator();
        while (iterator.hasNext()) {
            PersistentMessageHandle handle = (PersistentMessageHandle) iterator.next();
            String messageId = handle.getMessageId();
            MessageRef reference = cache.getMessageRef(messageId);
            if (reference == null) {
                reference = new CachedMessageRef(messageId, true, cache);
            }
            cache.addMessageRef(reference);
            handle.reference(reference);
            _handles.add(new QueueConsumerMessageHandle(handle));

            checkMessageExpiry(reference, handle.getExpiryTime());
        }
    }

    /**
     * Add a message, and notify any listeners.
     *
     * @param reference a reference to the message
     * @param message the message
     * @param handle the handle to add
     * @throws JMSException for any error
     */
    protected void addMessage(MessageRef reference, MessageImpl message,
                              MessageHandle handle) throws JMSException {
        addMessage(reference, message);
        _handles.add(handle);

        // notify any queue listeners that a message has arrived
        notifyQueueListeners(handle, message);

        // create a lease iff one is required
        checkMessageExpiry(reference, message);
    }


    /**
     * Notify queue browsers that a message has arrived.
     *
     * @param handle a handle to the message
     * @param message the message
     * @throws JMSException if a browser fails to handle the message
     */
    protected void notifyQueueListeners(MessageHandle handle,
                                        MessageImpl message)
            throws JMSException {
        QueueBrowserEndpoint[] browsers =
                (QueueBrowserEndpoint[]) _browsers.toArray(
                        new QueueBrowserEndpoint[0]);

        for (int index = 0; index < browsers.length; ++index) {
            QueueBrowserEndpoint browser = browsers[index];
            browser.messageAdded(handle, message);
        }
    }

    /**
     * Remove an expired non-peristent message, and notify any listeners.
     *
     * @param reference the reference to the expired message
     * @throws JMSException for any error
     */
    protected void messageExpired(MessageRef reference) throws JMSException {
        _handles.remove(reference.getMessageId());
        // @todo - notify browser
        super.messageExpired(reference);
    }

    /**
     * Remove an expired persistent message, and notify any listeners.
     *
     * @param reference  the reference to the expired message
     * @param connection the database connection to use
     * @throws JMSException         if a listener fails to handle the
     *                              expiration
     * @throws PersistenceException if there is a persistence related problem
     */
    protected void persistentMessageExpired(MessageRef reference,
                                            Connection connection)
            throws JMSException, PersistenceException {
        _handles.remove(reference.getMessageId());
        // @todo - notify browsers
        super.messageExpired(reference);
    }

    /**
     * Return the next QueueConsumerEndpoint that can consume the
     * specified message or null if there is none.
     *
     * @param message - the message to consume
     * @return the consumer who should receive this message, or null
     */
    private synchronized QueueConsumerEndpoint getEndpointForMessage(
            MessageImpl message) {
        QueueConsumerEndpoint result = null;

        ConsumerEndpoint[] consumers = getConsumerArray();
        final int size = consumers.length;
        if (size > 0) {
            // roll over the consumer index if it is greater
            // than the number of registered consumers
            if ((_lastConsumerIndex + 1) > size) {
                _lastConsumerIndex = 0;
            }

            // look over the list of consumers and return the
            // first endpoint that can process this message
            int index = _lastConsumerIndex;
            do {
                QueueConsumerEndpoint endpoint =
                        (QueueConsumerEndpoint) consumers[index];
                Selector selector = endpoint.getSelector();

                // if the endpoint has a message listener registered
                // or the endpoint is waiting for a message and the
                // message satisfies the selector then return it to
                // the client.
                if (((endpoint.hasMessageListener()) ||
                        (endpoint.isWaitingForMessage())) &&
                        ((selector == null) ||
                        (selector.selects(message)))) {
                    _lastConsumerIndex = ++index;
                    result = endpoint;
                    break;
                }

                // advance to the next consumer
                if (++index >= size) {
                    index = 0;
                }
            } while (index != _lastConsumerIndex);
        }

        return result;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人欧美一区二区三区黑人麻豆 | 色诱亚洲精品久久久久久| 日韩精品一区二区三区在线观看| 日本女优在线视频一区二区| 欧美一区二区三区在线观看视频| 日本美女一区二区三区| 日韩三级视频中文字幕| 激情综合一区二区三区| 欧美国产视频在线| 色婷婷综合五月| 亚洲sss视频在线视频| 日韩一区二区在线看片| 激情国产一区二区 | 欧美人xxxx| 精品一区二区三区视频| 国产精品国产三级国产专播品爱网 | 欧美激情一区二区三区不卡| 91一区一区三区| 亚洲va韩国va欧美va精品| 精品久久久久久久久久久院品网| 不卡影院免费观看| 亚洲午夜影视影院在线观看| 精品日韩一区二区三区| a美女胸又www黄视频久久| 亚洲bt欧美bt精品777| 精品国产乱码久久久久久闺蜜| jlzzjlzz亚洲女人18| 丝袜诱惑亚洲看片| 国产欧美一区二区精品婷婷| 在线亚洲一区观看| 激情av综合网| 亚洲国产中文字幕在线视频综合| 日韩一区二区三| k8久久久一区二区三区| 蜜臀精品一区二区三区在线观看| 最新日韩av在线| 欧美一级久久久| 色综合天天综合网天天狠天天 | jvid福利写真一区二区三区| 日韩电影在线观看电影| 亚洲免费三区一区二区| 久久久久99精品国产片| 欧美放荡的少妇| 一本到不卡免费一区二区| 国产麻豆视频精品| 日韩av在线发布| 一区二区国产视频| 国产欧美综合在线| 日韩精品一区二区三区蜜臀 | 日韩久久精品一区| 欧美日韩国产另类一区| 91免费在线视频观看| 国产成人h网站| 久久疯狂做爰流白浆xx| 亚洲国产精品人人做人人爽| 国产精品国产馆在线真实露脸 | 亚洲妇女屁股眼交7| 国产精品国产三级国产aⅴ入口| 26uuu色噜噜精品一区| 日韩一区二区中文字幕| 91精品久久久久久蜜臀| 91成人免费在线| 91国产成人在线| 日本精品视频一区二区三区| 成人精品高清在线| 国产91清纯白嫩初高中在线观看| 黄网站免费久久| 免费观看91视频大全| 日韩精品一二区| 日韩电影在线一区二区| 亚洲综合免费观看高清完整版| 日韩一区日韩二区| 亚洲女同一区二区| 亚洲一区在线看| 亚洲成va人在线观看| 天堂va蜜桃一区二区三区漫画版| 亚洲在线视频网站| 午夜精品福利一区二区三区蜜桃| 亚洲与欧洲av电影| 午夜欧美大尺度福利影院在线看| 亚洲一区二区在线免费观看视频| 一区二区三区欧美久久| 亚洲一区二区在线观看视频| 亚洲国产日韩av| 日韩av一级电影| 激情图片小说一区| 国产成人综合在线| 色综合一区二区| 欧美另类变人与禽xxxxx| 欧美一级黄色大片| 国产亚洲自拍一区| **网站欧美大片在线观看| 亚洲一区二区三区视频在线播放| 亚洲bt欧美bt精品777| 美女一区二区久久| 国产精品99久久久| 一本久久a久久精品亚洲| 精品视频在线免费看| 欧美成人猛片aaaaaaa| 欧美经典一区二区| 一区二区三区在线视频观看58| 亚洲第四色夜色| 日本韩国精品在线| 欧美日韩高清一区二区不卡| 欧美一二三四在线| 国产精品婷婷午夜在线观看| 亚洲一区二区三区中文字幕在线| 老司机精品视频导航| av一二三不卡影片| 欧美一区二区在线免费观看| 久久综合色综合88| 亚洲视频电影在线| 美腿丝袜一区二区三区| 床上的激情91.| 欧美日韩国产高清一区二区三区 | 国产精品伊人色| 91国偷自产一区二区三区成为亚洲经典 | 欧美裸体bbwbbwbbw| 国产日韩欧美高清在线| 亚洲亚洲人成综合网络| 国内久久婷婷综合| 欧美综合一区二区| 久久天天做天天爱综合色| 亚洲精品欧美综合四区| 国产麻豆精品95视频| 欧美亚洲国产一区在线观看网站 | 亚洲综合视频网| 国产精品自在欧美一区| 欧美中文字幕一二三区视频| 精品不卡在线视频| 亚洲成人av在线电影| 不卡影院免费观看| 久久久午夜电影| 日韩**一区毛片| 欧美性xxxxx极品少妇| 国产日韩欧美精品一区| 另类小说综合欧美亚洲| 欧美日韩五月天| 日韩美女久久久| 国产成人免费视| 欧美大黄免费观看| 亚洲成人av免费| 色哟哟国产精品| 国产精品热久久久久夜色精品三区| 久久国产精品色婷婷| 欧美剧在线免费观看网站| 亚洲人123区| 99re这里都是精品| 国产欧美一区视频| 激情综合网av| 精品盗摄一区二区三区| 日一区二区三区| 欧美性高清videossexo| 亚洲视频网在线直播| 白白色 亚洲乱淫| 久久久久免费观看| 久久er精品视频| 日韩欧美不卡一区| 久久精品99国产精品| 制服丝袜在线91| 午夜视频在线观看一区二区| 欧美三级视频在线| 午夜电影网一区| 欧美日韩一卡二卡三卡| 亚洲午夜一二三区视频| 欧美在线高清视频| 亚洲18色成人| 欧美一区二区三区日韩| 久久成人免费电影| 久久人人爽人人爽| 国产成人精品亚洲777人妖 | 一二三区精品视频| 91福利视频在线| 视频在线观看一区| 日韩欧美资源站| 精品一区二区在线视频| 久久这里只有精品视频网| 国产成人午夜高潮毛片| 国产精品毛片a∨一区二区三区| 白白色亚洲国产精品| 夜夜爽夜夜爽精品视频| 欧美日本不卡视频| 免费欧美在线视频| 国产偷v国产偷v亚洲高清| 成人精品视频网站| 一区二区三区日韩精品| 欧美一级片在线| 国产精品99久久久久| 亚洲精品日日夜夜| 日韩一区二区三区电影| 国产精品18久久久久| 综合久久久久久| 欧美日韩免费电影| 国产专区欧美精品| 最新日韩在线视频| 日韩亚洲欧美中文三级| 成人美女视频在线看| 午夜婷婷国产麻豆精品| 久久精品人人做| 欧美在线不卡视频|