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

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

?? jmsmessageproducer.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
字號:
/**
 * 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: JmsMessageProducer.java,v 1.2 2005/03/18 03:36:37 tanderson Exp $
 */
package org.exolab.jms.client;

import java.util.Date;

import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.InvalidDestinationException;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageFormatException;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.exolab.jms.message.MessageId;


/**
 * Client implementation of the <code>javax.jms.MessageProducer</code>
 * interface
 *
 * @version     $Revision: 1.2 $ $Date: 2005/03/18 03:36:37 $
 * @author      <a href="mailto:jima@comware.com.au">Jim Alateras</a>
 * @author      <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 */
class JmsMessageProducer implements MessageProducer {

    /**
     * The destination that messages are delivered to, or <code>null</code>
     * if this is an unidentified producer.
     */
    private final Destination _destination;

    /**
     * The default priority for messages.
     */
    private int _defaultPriority = Message.DEFAULT_PRIORITY;

    /**
     * The default time to live for messages.
     */
    private long _defaultTtl = 0;

    /**
     * The default delivery mode for messages.
     */
    private int _deliveryMode = DeliveryMode.PERSISTENT;

    /**
     * This flag is used to indicate whether timestamps are enabled or
     * disabled.
     */
    private boolean _disableTimestamp = false;

    /**
     * This flag is used to indicate whether message ids are enabled or
     * disabled.
     */
    private boolean _disableMessageId = false;

    /**
     * The session that created this producer.
     */
    private JmsSession _session = null;


    /**
     * Construct a new <code>JmsMessageProducer</code>.
     *
     * @param session session responsible for this producer
     * @param destination   the destination that messages are delivered to,
     * or <code>null</code> if this is an unidentified producer
     */
    public JmsMessageProducer(JmsSession session, Destination destination) {
        if (session == null) {
            throw new IllegalArgumentException("Argument 'session' is null");
        }
        _session = session;
        _destination = destination;
    }

    /**
     * Gets the destination associated with this <code>MessageProducer</code>.
     *
     * @return this producer's <code>Destination/<code>
     */
    public Destination getDestination() {
        return _destination;
    }

    /**
     * Set whether message IDs are disabled.
     *
     * @param value indicates if message IDs are disabled
     */
    public void setDisableMessageID(boolean value) {
        _disableMessageId = value;
    }

    /**
     * Returns if message IDs are disabled
     *
     * @return <code>true</code> if message IDs are disabled
     */
    public boolean getDisableMessageID() {
        return _disableMessageId;
    }

    /**
     * Set whether message timestamps are disabled.
     *
     * @param value indicates if message timestamps are disabled
     */
    public void setDisableMessageTimestamp(boolean value) {
        _disableTimestamp = value;
    }

    /**
     * Returns if message timestamps are disabled.
     *
     * @return <code>true</code> if message timestamps are disabled
     */
    public boolean getDisableMessageTimestamp() {
        return _disableTimestamp;
    }

    /**
     * Set the producer's default delivery mode.
     *
     * @param deliveryMode the delivery mode. Legal values are
     * <code>DeliveryMode.NON_PERSISTENT</code> or
     * <code>DeliveryMode.PERSISTENT</code>
     */
    public void setDeliveryMode(int deliveryMode) {
        _deliveryMode = deliveryMode;
    }

    /**
     * Returns the producer's default delivery mode.
     *
     * @return the default delivery mode
     */
    public int getDeliveryMode() {
        return _deliveryMode;
    }

    /**
     * Set the producer's default priority.
     *
     * @param priority the priority. Must be a value between 0 and 9
     */
    public void setPriority(int priority) {
        _defaultPriority = priority;
    }

    /**
     * Returns the producer's default delivery mode.
     *
     * @return the default delivery mode
     */
    public int getPriority() {
        return _defaultPriority;
    }

    /**
     * Set the default time to live for messages.
     *
     * @param timeToLive the message time to live in milliseconds; zero is
     * unlimited
     */
    public void setTimeToLive(long timeToLive) {
        _defaultTtl = timeToLive;
    }

    /**
     * Returns the default time to live for messages.
     *
     * @return the default message time to live in milliseconds; zero is
     * unlimited
     */
    public long getTimeToLive() {
        return _defaultTtl;
    }

    /**
     * Sends a message using the <code>MessageProducer</code>'s default delivery
     * mode, priority, and time to live.
     *
     * @param message the message to send
     * @throws JMSException                  if the JMS provider fails to send
     *                                       the message due to some internal
     *                                       error.
     * @throws MessageFormatException        if an invalid message is
     *                                       specified.
     * @throws InvalidDestinationException   if a client uses this method with a
     *                                       <code>MessageProducer</code> with
     *                                       an invalid destination.
     * @throws UnsupportedOperationException if a client uses this method with a
     *                                       <code>MessageProducer</code> that
     *                                       did not specify a destination at
     *                                       creation time.
     */
    public void send(Message message) throws JMSException {
        send(getDestination(), message, getDeliveryMode(), getPriority(),
             getTimeToLive());
    }

    /**
     * Sends a message to the destination, specifying delivery mode, priority,
     * and time to live.
     *
     * @param message      the message to send
     * @param deliveryMode the delivery mode to use
     * @param priority     the priority for this message
     * @param timeToLive   the message's lifetime (in milliseconds)
     * @throws JMSException                  if the JMS provider fails to send
     *                                       the message due to some internal
     *                                       error.
     * @throws MessageFormatException        if an invalid message is
     *                                       specified.
     * @throws InvalidDestinationException   if a client uses this method with a
     *                                       <code>MessageProducer</code> with
     *                                       an invalid destination.
     * @throws UnsupportedOperationException if a client uses this method with a
     *                                       <code>MessageProducer</code> that
     *                                       did not specify a destination at
     *                                       creation time.
     */
    public void send(Message message, int deliveryMode, int priority,
                     long timeToLive) throws JMSException {
        send(getDestination(), message, deliveryMode, priority, timeToLive);
    }

    /**
     * Sends a message to a destination for an unidentified message producer.
     * Uses the <code>MessageProducer</code>'s default delivery mode, priority,
     * and time to live.
     * <p/>
     * <P>Typically, a message producer is assigned a destination at creation
     * time; however, the JMS API also supports unidentified message producers,
     * which require that the destination be supplied every time a message is
     * sent.
     *
     * @param destination the destination to send this message to
     * @param message     the message to send
     * @throws JMSException                  if the JMS provider fails to send
     *                                       the message due to some internal
     *                                       error.
     * @throws MessageFormatException        if an invalid message is
     *                                       specified.
     * @throws InvalidDestinationException   if a client uses this method with
     *                                       an invalid destination.
     * @throws UnsupportedOperationException if a client uses this method with a
     *                                       <code>MessageProducer</code> that
     *                                       specified a destination at creation
     *                                       time.
     */
    public void send(Destination destination, Message message)
            throws JMSException {
        send(destination, message, getDeliveryMode(), getPriority(),
             getTimeToLive());
    }

    /**
     * Sends a message to a destination for an unidentified message producer,
     * specifying delivery mode, priority and time to live.
     * <p/>
     * <P>Typically, a message producer is assigned a destination at creation
     * time; however, the JMS API also supports unidentified message producers,
     * which require that the destination be supplied every time a message is
     * sent.
     *
     * @param destination  the destination to send this message to
     * @param message      the message to send
     * @param deliveryMode the delivery mode to use
     * @param priority     the priority for this message
     * @param timeToLive   the message's lifetime (in milliseconds)
     * @throws JMSException                if the JMS provider fails to send the
     *                                     message due to some internal error.
     * @throws MessageFormatException      if an invalid message is specified.
     * @throws InvalidDestinationException if a client uses this method with an
     *                                     invalid destination.
     */
    public void send(Destination destination, Message message,
                     int deliveryMode, int priority, long timeToLive)
            throws JMSException {

        if (!(destination instanceof JmsDestination)) {
            // don't support non-OpenJMS or null destinations
            throw new InvalidDestinationException(
                "Invalid destination: " + destination);
        }
        if (message == null) {
            throw new MessageFormatException("Null message");
        }

        message.setJMSMessageID(MessageId.create());
        message.setJMSDestination(destination);
        message.setJMSTimestamp((new Date()).getTime());
        message.setJMSPriority(priority);

        if (timeToLive > 0) {
            message.setJMSExpiration(System.currentTimeMillis() + timeToLive);
        } else {
            message.setJMSExpiration(0);
        }

        // if the destination is a temporary one, override the delivery
        // mode to NON_PERSISTENT
        if (destination instanceof JmsTemporaryDestination) {
            message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
        } else {
            message.setJMSDeliveryMode(deliveryMode);
        }

        _session.sendMessage(message);
    }

    /**
     * Close the producer.
     *
     * @throws JMSException if the producer can't be closed
     */
    public synchronized void close() throws JMSException {
        if (_session != null) {
            _session.removeProducer(this);
        }
        _session = null;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区在线电影| 久久草av在线| 蜜桃av噜噜一区二区三区小说| 国产精品一区在线| 欧美在线视频你懂得| 久久精品亚洲一区二区三区浴池| 一区二区在线看| 粉嫩aⅴ一区二区三区四区五区| 欧美久久一二区| 亚洲日穴在线视频| 国产91色综合久久免费分享| 欧美一级黄色大片| 亚洲成人综合在线| 色妞www精品视频| 欧美韩日一区二区三区四区| 久久er99精品| 日韩一区二区三区高清免费看看| 一级特黄大欧美久久久| 成人久久18免费网站麻豆| 欧美精品一区二区三区久久久| 亚洲bt欧美bt精品| 在线看一区二区| 亚洲精品成人在线| 色综合色综合色综合色综合色综合| 亚洲国产精品精华液2区45| 国产在线播放一区三区四| 欧美一区二区三区免费大片| 婷婷国产在线综合| 欧美日韩国产免费一区二区| 亚洲国产成人tv| 欧美三级在线看| 亚洲制服丝袜一区| 在线免费观看日韩欧美| 亚洲一区视频在线观看视频| 99热精品一区二区| 亚洲免费大片在线观看| 色欧美日韩亚洲| 亚洲午夜久久久| 777午夜精品免费视频| 日韩国产欧美在线视频| 欧美一卡二卡在线| 经典三级视频一区| 久久精品一区二区三区四区| 成人毛片老司机大片| 中文字幕第一区二区| 91精品办公室少妇高潮对白| 亚洲午夜久久久| 日韩女同互慰一区二区| 国产成人在线免费观看| 亚洲视频小说图片| 欧美日韩精品系列| 久久99国产乱子伦精品免费| 国产亚洲va综合人人澡精品 | 国产精品理论在线观看| 色综合久久九月婷婷色综合| 亚洲曰韩产成在线| 精品国产欧美一区二区| 成人av影院在线| 一区二区免费看| 日韩精品一区二区三区视频播放 | 日韩亚洲欧美一区| 国产精品亚洲视频| 亚洲色图视频网| 91精品久久久久久久99蜜桃| 国产成人精品综合在线观看| 久久综合久色欧美综合狠狠| aa级大片欧美| 日本不卡一二三| 亚洲视频你懂的| 91精品国产色综合久久不卡电影 | 五月天精品一区二区三区| 精品不卡在线视频| 91小视频在线免费看| 日韩专区在线视频| 亚洲国产成人午夜在线一区| 欧美视频中文一区二区三区在线观看| 久久99久久99小草精品免视看| 中文字幕一区免费在线观看| 91精品国产综合久久久久久久久久 | av激情综合网| 日韩国产在线观看| 国产精品乱人伦一区二区| 91精品免费观看| 色婷婷狠狠综合| 国产一区二区三区综合| 亚洲国产aⅴ天堂久久| 欧美高清在线视频| 欧美电视剧在线观看完整版| 欧美综合一区二区| 成人美女在线观看| 国产专区欧美精品| 日精品一区二区| 亚洲夂夂婷婷色拍ww47| 亚洲欧洲性图库| 国产亚洲精品福利| 精品国产一区二区三区久久影院| 欧美日韩一区国产| 色94色欧美sute亚洲线路一ni | 亚洲图片欧美色图| 国产精品麻豆一区二区| 久久综合成人精品亚洲另类欧美 | 日本中文一区二区三区| 亚洲激情男女视频| 成人免费一区二区三区在线观看| 久久久久久亚洲综合影院红桃| 欧美一区二区三区日韩视频| 欧美日韩视频第一区| 欧美视频三区在线播放| 日本韩国欧美国产| 91麻豆福利精品推荐| 91小视频在线免费看| 99精品一区二区| 不卡一区中文字幕| 91在线你懂得| 一本色道亚洲精品aⅴ| 91视频免费观看| 色欧美乱欧美15图片| 日本久久一区二区| 欧美日韩一区二区三区在线看| 欧美综合欧美视频| 欧美顶级少妇做爰| 欧美日本乱大交xxxxx| 91精品国产综合久久小美女| 欧美一区二区三区四区久久| 精品国产一区二区精华| 久久精品免视看| 亚洲国产精品精华液2区45| 亚洲视频小说图片| 天天影视网天天综合色在线播放| 日韩成人精品在线| 国产激情精品久久久第一区二区| 成人午夜视频在线| 97久久精品人人澡人人爽| 欧美中文一区二区三区| 日韩午夜小视频| 国产三级三级三级精品8ⅰ区| 国产精品久久久久久久久动漫| 亚洲欧美日韩成人高清在线一区| 亚洲国产日日夜夜| 国模一区二区三区白浆| 成人福利电影精品一区二区在线观看| 97精品超碰一区二区三区| 欧美日韩亚洲综合一区| 久久这里只有精品首页| 亚洲欧美综合另类在线卡通| 亚洲成人一区二区| 国产毛片精品视频| 欧美性一二三区| 欧美mv日韩mv| 亚洲日本在线视频观看| 国产成人综合亚洲网站| 高清beeg欧美| 欧美丰满嫩嫩电影| 国产精品全国免费观看高清| 性感美女极品91精品| 国产曰批免费观看久久久| 在线中文字幕一区二区| 精品成a人在线观看| 亚洲一区在线观看免费观看电影高清| 精品在线亚洲视频| 91久久精品日日躁夜夜躁欧美| 精品国产人成亚洲区| 亚洲成av人**亚洲成av**| 国产999精品久久久久久| 欧美日韩国产首页在线观看| 国产精品美女久久久久久久久久久 | 成人免费视频caoporn| 在线成人av网站| 亚洲日本护士毛茸茸| 久久精品国产免费看久久精品| 91福利在线导航| 国产精品丝袜一区| 美女国产一区二区| 欧美日免费三级在线| 亚洲欧洲av色图| 国产大陆精品国产| 91精品国产一区二区三区| 亚洲自拍另类综合| 91老司机福利 在线| 日本一区二区三区四区| 捆绑紧缚一区二区三区视频| 精品视频一区二区不卡| 国产精品福利一区二区| 国产一区二区看久久| 日韩女优电影在线观看| 日韩精品午夜视频| 欧美日韩视频专区在线播放| 一区二区欧美视频| 91色综合久久久久婷婷| 国产人成亚洲第一网站在线播放| 捆绑调教美女网站视频一区| 欧美一区二区私人影院日本| 亚洲一区在线免费观看| 日本国产一区二区| 一区二区在线电影| 色老汉一区二区三区| 亚洲欧美成人一区二区三区| 99精品视频在线播放观看| 亚洲欧洲成人自拍| 99久久精品免费看国产|