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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jmsserversession.java

?? 一個(gè)java方面的消息訂閱發(fā)送的源碼
?? JAVA
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/**
 * 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: JmsServerSession.java,v 1.2 2005/03/18 04:07:02 tanderson Exp $
 */
package org.exolab.jms.server;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.jms.DeliveryMode;
import javax.jms.InvalidDestinationException;
import javax.jms.JMSException;
import javax.jms.Session;
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.client.JmsDestination;
import org.exolab.jms.client.JmsMessageListener;
import org.exolab.jms.client.JmsQueue;
import org.exolab.jms.client.JmsTopic;
import org.exolab.jms.message.MessageImpl;
import org.exolab.jms.messagemgr.ConsumerEndpoint;
import org.exolab.jms.messagemgr.ConsumerManager;
import org.exolab.jms.messagemgr.DestinationManager;
import org.exolab.jms.messagemgr.ConsumerEndpointListener;
import org.exolab.jms.messagemgr.MessageHandle;
import org.exolab.jms.messagemgr.MessageMgr;
import org.exolab.jms.messagemgr.QueueBrowserEndpoint;
import org.exolab.jms.messagemgr.ResourceManager;
import org.exolab.jms.messagemgr.ResourceManagerException;
import org.exolab.jms.server.ServerSession;
import org.exolab.jms.server.JmsServerConnection;
import org.exolab.jms.server.SentMessageCache;


/**
 * A session represents a server side endpoint to the JMSServer. A client can
 * create producers, consumers and destinations through the session in addi-
 * tion to other functions. A session has a unique identifer which is a comb-
 * ination of clientId-connectionId-sessionId.
 * <p/>
 * A session represents a single-threaded context which implies that it cannot
 * be used with more than one thread concurrently. Threads registered with this
 * session are synchronized.
 * <p/>
 * Finally, instances of this object can only be created by classes within the
 * same package.
 *
 * @author <a href="mailto:jima@exoffice.com">Jim Alateras</a>
 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 * @version $Revision: 1.2 $ $Date: 2005/03/18 04:07:02 $
 * @see JmsServerConnection
 */
public class JmsServerSession
        implements ServerSession, ConsumerEndpointListener, XAResource {

    /**
     * Back pointer to the connection that created this session. This is set
     * during object creation time
     */
    private JmsServerConnection _connection = null;

    /**
     * Maintain a set of ConsumerEndpoint instances, keyed on id
     */
    private HashMap _consumers = new HashMap();

    /**
     * The message listener is the reference to a remote client that will
     * receive the messages
     */
    private JmsMessageListener _listener = null;

    /**
     * This is the acknowledgement mode for the session
     */
    private int _ackMode = Session.AUTO_ACKNOWLEDGE;

    /**
     * Indicates whether the session is transactional
     */
    private boolean _transacted = false;

    /**
     * Holds the current xid that this session is associated with. A session can
     * olny be associated with one xid at any one time.
     */
    private Xid _xid = null;

    /**
     * Indicates if the underlying connection of this session has been stopped
     */
    private boolean _stopped = true;

    /**
     * Indicated that the session has been closed
     */
    private boolean _closed = false;

    /**
     * Caches all sent messages
     */
    private SentMessageCache _sentMessageCache;

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


    /**
     * Construct a new <code>JmsServerSession</code>
     *
     * @param connection the connection that created this session
     * @param ackMode    the acknowledgement mode for the session
     * @param transacted <code>true</code> if the session is transactional
     */
    public JmsServerSession(JmsServerConnection connection, int ackMode,
                               boolean transacted) {
        _connection = connection;
        _ackMode = ackMode;
        _transacted = transacted;
        _stopped = true;
        _sentMessageCache = new SentMessageCache(this);
    }

    /**
     * Returns the identifier of the connection that created this session
     *
     * @return the connection identifier
     */
    public long getConnectionId() {
        return _connection.getConnectionId();
    }

    /**
     * Acknowledge that a message has been processed
     *
     * @param consumerId the identity of the consumer performing the ack
     * @param messageId  the message identifier
     * @throws JMSException for any error
     */
    public void acknowledgeMessage(long consumerId, String messageId)
            throws JMSException {
        _sentMessageCache.acknowledgeMessage(messageId, consumerId);
    }

    /**
     * Send a message
     *
     * @param message the message to send
     * @throws JMSException for any error
     */
    public void send(MessageImpl message) throws JMSException {
        if (message == null) {
            throw new JMSException("Message is null");
        }

        try {
            // check the delivery mode of the message
            checkDeliveryMode((MessageImpl) message);

            // set the connection identity and then let the message manager
            // process it
            ((MessageImpl) message).setConnectionId(_connection.getConnectionId());

            // if there is a global transaction currently in process then
            // we must send the message to the resource manager, otherwise
            // send it directly to the message manager
            if (_xid != null) {
                ResourceManager.instance().logPublishedMessage(_xid,
                                                               (MessageImpl) message);
            } else {
                MessageMgr.instance().add((MessageImpl) message);
            }
        } catch (JMSException exception) {
            _log.error("Failed to process message", exception);
            throw exception;
        } catch (OutOfMemoryError exception) {
            String msg =
                    "Failed to process message due to out-of-memory error";
            _log.error(msg, exception);
            throw new JMSException(msg);
        } catch (Exception exception) {
            String msg = "Failed to process message";
            _log.error(msg, exception);
            throw new JMSException(msg);
        }
    }

    /**
     * Send a set of messages
     *
     * @param messages a list of <code>MessageImpl</code> instances
     * @throws JMSException for any JMS error
     */
    public void send(List messages) throws JMSException {
        if (messages == null) {
            throw new JMSException("Argument 'messages' is null");
        }

        Iterator iterator = messages.iterator();
        while (iterator.hasNext()) {
            MessageImpl message = (MessageImpl) iterator.next();
            send(message);
        }
    }

    /**
     * Return the next available message to the specified consumer.
     * <p/>
     * The <code>wait</code> parameter indicates how many milliseconds to wait
     * for a message before returning. If <code>wait</code> is <code>0</code>
     * then do not wait. If <code>wait</code> is <code>-1</code> then wait
     * indefinitely for the next message.
     *
     * @param consumerId the consumer identifier
     * @param wait       number of milliseconds to wait
     * @return the next message or <code>null</code>
     * @throws JMSException for any JMS error
     */
    public MessageImpl receive(long consumerId, long wait)
            throws JMSException {
        MessageImpl message = null;
        ConsumerEndpoint consumer = getConsumerEndpoint(consumerId);
        if (consumer == null) {
            throw new JMSException("Can't receive message: no consumer registered with "
                                   + "identifier "
                                   + consumerId
                                   + " on session");
        }

        // got a valid consumer, so retrieve a handle.
        MessageHandle handle = consumer.receive(wait);

        if (handle != null) {
            // if we get a non-null handle, retrieve the message
            MessageImpl orig = handle.getMessage();
            if (orig != null) {
                // now clone the message to set client specific properties
                try {
                    message = (MessageImpl) orig.clone();
                    message.setJMSRedelivered(handle.getDelivered());
                    message.setConsumerId(handle.getConsumerId());
                } catch (Exception exception) {
                    _log.error(exception);
                }
            }
        }

        // if we have a non-null message then add it to the sent message
        // cache. Additionally, if we are part of a global transaction then
        // we must also sent it to the ResourceManager for recovery.
        if (message != null) {
            _sentMessageCache.process(handle);

            if (_xid != null) {
                try {
                    ResourceManager.instance().logReceivedMessage(_xid,
                                                                  consumer.getId(),
                                                                  handle);
                } catch (Exception exception) {
                    _log.error(exception);
                    JMSException error = new JMSException("Error in receive");
                    error.setLinkedException(exception);
                    throw error;
                }
            }
        }

        return message;
    }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产偷国产偷亚洲高清人白洁| 久久综合精品国产一区二区三区| 国内不卡的二区三区中文字幕 | 天天色 色综合| 国产视频一区二区三区在线观看| 精品1区2区3区| 不卡视频在线看| 美美哒免费高清在线观看视频一区二区| 亚洲色图色小说| 久久色.com| 日韩小视频在线观看专区| 欧美系列亚洲系列| www.亚洲激情.com| 国产电影一区在线| 久久99国产乱子伦精品免费| 亚洲国产精品影院| 亚洲欧美偷拍卡通变态| 日本一区二区高清| 久久午夜老司机| 欧美videossexotv100| 日韩限制级电影在线观看| 欧美日本乱大交xxxxx| 色偷偷一区二区三区| 成a人片国产精品| 国产精品18久久久久久久网站| 免费成人在线播放| 蜜臂av日日欢夜夜爽一区| 日本系列欧美系列| 日本最新不卡在线| 美女网站视频久久| 九九精品视频在线看| 精品一区二区三区视频在线观看| 老司机免费视频一区二区| 免费日本视频一区| 日韩成人一区二区| 日韩 欧美一区二区三区| 日本在线播放一区二区三区| 无码av免费一区二区三区试看| 午夜电影久久久| 午夜激情综合网| 美女性感视频久久| 国产麻豆精品95视频| 成人在线一区二区三区| 成人免费黄色在线| 97久久精品人人做人人爽50路| www.视频一区| 欧美丝袜第三区| 欧美丰满少妇xxxbbb| 91精品国产麻豆| 精品va天堂亚洲国产| 国产日本一区二区| 亚洲欧美乱综合| 亚洲电影第三页| 日韩**一区毛片| 国产精品资源在线| 成人av在线看| 欧洲精品一区二区| 日韩区在线观看| 亚洲国产成人私人影院tom | 久久精品国产网站| 国产999精品久久久久久绿帽| 91免费视频网| 欧美午夜电影一区| 久久天堂av综合合色蜜桃网| 国产精品私人影院| 亚洲高清三级视频| 精品一区二区三区av| youjizz久久| 欧美日韩成人在线| 久久蜜桃av一区二区天堂 | 欧美一级精品在线| 国产女人aaa级久久久级| 夜夜揉揉日日人人青青一国产精品 | 久久久久久毛片| 亚洲精品国产无天堂网2021| 男女激情视频一区| 99精品国产99久久久久久白柏| 欧美伊人久久久久久午夜久久久久| 日韩一级视频免费观看在线| 国产精品久久久久影院色老大| 日韩精品一级中文字幕精品视频免费观看 | 精品一区二区日韩| 色婷婷综合视频在线观看| 日韩一级欧美一级| 136国产福利精品导航| 伦理电影国产精品| 欧美午夜在线观看| 久久精品日韩一区二区三区| 五月激情综合色| 99久久精品免费精品国产| 日韩视频在线你懂得| 亚洲免费在线观看视频| 九色porny丨国产精品| 欧洲一区二区av| 国产精品国产自产拍高清av| 免费看欧美女人艹b| 色婷婷综合久久久久中文| 国产视频在线观看一区二区三区 | 久久精品一级爱片| 亚洲图片欧美一区| 本田岬高潮一区二区三区| wwww国产精品欧美| 视频一区视频二区中文字幕| 色94色欧美sute亚洲线路一ni| 久久青草欧美一区二区三区| 日本欧美韩国一区三区| 在线免费精品视频| 日韩毛片一二三区| 国产高清视频一区| 日韩精品综合一本久道在线视频| 亚洲二区在线视频| 色成年激情久久综合| 国产精品天美传媒| 国产91精品久久久久久久网曝门| 日韩一二三四区| 五月天一区二区三区| 日本高清成人免费播放| 1000精品久久久久久久久| 成人免费视频免费观看| 久久精品人人做人人爽人人| 国内精品久久久久影院薰衣草 | 国产一区二区不卡| 精品对白一区国产伦| 久久99精品久久久久婷婷| 欧美一区二视频| 美女一区二区在线观看| 日韩一区二区三区精品视频| 亚洲成人www| 69堂成人精品免费视频| 偷拍一区二区三区| 欧美一级夜夜爽| 日本欧美在线看| 欧美成人精品福利| 久久99在线观看| 久久午夜羞羞影院免费观看| 国产福利一区在线| 亚洲国产成人自拍| 91啦中文在线观看| 一区二区三区中文在线| 在线观看欧美精品| 午夜精品久久久| 日韩美女一区二区三区| 国内精品国产成人| 欧美国产精品v| 日本乱码高清不卡字幕| 亚洲国产精品天堂| 日韩午夜激情免费电影| 国产在线一区观看| 国产日本欧洲亚洲| 91福利在线免费观看| 日韩成人午夜精品| 久久综合狠狠综合久久激情| 不卡的av中国片| 亚洲国产一区二区a毛片| 欧美一区二区三区免费在线看 | 欧美经典三级视频一区二区三区| 处破女av一区二区| 一区二区三区四区在线播放| 69堂国产成人免费视频| 国产精品 欧美精品| 亚洲嫩草精品久久| 在线综合亚洲欧美在线视频| 国产在线一区二区综合免费视频| 中文字幕中文字幕在线一区| 欧美日本在线播放| 国产精品中文字幕一区二区三区| 中文字幕一区二| 91麻豆精品国产自产在线观看一区 | 欧美精品视频www在线观看| 韩国av一区二区三区| 亚洲美女电影在线| 日韩欧美电影一二三| 97久久超碰国产精品| 人人爽香蕉精品| 国产精品水嫩水嫩| 欧美一区三区四区| 91一区一区三区| 精品综合久久久久久8888| 亚洲欧美综合网| 欧美疯狂做受xxxx富婆| 成人午夜电影小说| 免费在线看一区| 亚洲卡通动漫在线| 欧美精品一区二区三区一线天视频| 99精品视频在线免费观看| 美女视频第一区二区三区免费观看网站 | 色哟哟一区二区在线观看| 精彩视频一区二区| 亚洲成人动漫在线免费观看| 国产欧美综合色| 日韩欧美123| 一本到不卡精品视频在线观看| 国产在线日韩欧美| 五月天中文字幕一区二区| 中文字幕在线一区免费| 久久久亚洲高清| 91精品国产欧美一区二区成人| 日本高清成人免费播放| 粉嫩av一区二区三区在线播放| 蜜桃视频一区二区三区在线观看|