コード例 #1
0
 public void send(
     Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
     throws JMSException {
   session.lock();
   try {
     if (trace)
       log.trace(
           "send "
               + this
               + " destination="
               + destination
               + " message="
               + message
               + " deliveryMode="
               + deliveryMode
               + " priority="
               + priority
               + " ttl="
               + timeToLive);
     producer.send(destination, message, deliveryMode, priority, timeToLive);
     if (trace) log.trace("sent " + this + " result=" + message);
   } finally {
     session.unlock();
   }
 }
コード例 #2
0
  /**
   * Sends a message to the destination
   *
   * @param destination the destination the message should be send to
   * @param message the message to send
   * @param deliveryMode the delivery mode
   * @param priority the priority
   * @param timeToLive how long the message should live
   */
  public void send(
      Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
      throws JMSException {
    if (destination == null) destination = _queue;
    else if (_queue != null && destination != _queue)
      throw new UnsupportedOperationException(
          L.l("MessageProducer: '{0}' does not match the queue '{1}'", destination, _queue));

    if (destination == null)
      throw new UnsupportedOperationException(
          L.l("MessageProducer: null destination is not supported."));

    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("getDeliveryMode(): message producer is closed."));

    if (destination instanceof TemporaryTopicImpl) {

      // Message can not be sent on Temporary Queue if Session is not active.
      if (((TemporaryTopicImpl) destination).isClosed()) {
        throw new javax.jms.IllegalStateException(
            L.l("temporary queue '{0}' session is not active", destination));
      }
    }

    _session.send((AbstractDestination) destination, message, deliveryMode, priority, timeToLive);
    // _session.checkThread();
  }
コード例 #3
0
 public void send(Destination destination, Message message) throws JMSException {
   session.lock();
   try {
     if (trace) log.trace("send " + this + " destination=" + destination + " message=" + message);
     producer.send(destination, message);
     if (trace) log.trace("sent " + this + " result=" + message);
   } finally {
     session.unlock();
   }
 }
コード例 #4
0
  /** Sets true if message ids should be disabled by default. */
  public void setDisableMessageID(boolean disable) throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("setDisableMessageID(): message producer is closed."));

    _disableMessageId = disable;
  }
コード例 #5
0
  /** Returns true if message ids are disabled by default. */
  public boolean getDisableMessageID() throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("getDisableMessageID(): message producer is closed."));

    return _disableMessageId;
  }
コード例 #6
0
  /** Sets the default delivery mode. */
  public void setDeliveryMode(int deliveryMode) throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("setDeliveryMode(): message producer is closed."));

    _deliveryMode = deliveryMode;
  }
コード例 #7
0
  /** Returns the default delivery mode. */
  public int getDeliveryMode() throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("getDeliveryMode(): message producer is closed."));

    return _deliveryMode;
  }
コード例 #8
0
  /** Returns the producer's destination. */
  public Destination getDestination() throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("getDestination(): message producer is closed."));

    return _queue;
  }
コード例 #9
0
  /** Sets the default time to live. */
  public void setTimeToLive(long timeToLive) throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("setTimeToLive(): message producer is closed."));

    _timeToLive = timeToLive;
  }
コード例 #10
0
  /** Returns the default time to live */
  public long getTimeToLive() throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("getTimeToLive(): message producer is closed."));

    return _timeToLive;
  }
コード例 #11
0
  /** Sets the default priority. */
  public void setPriority(int priority) throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(
          L.l("setDeliveryMode(): message producer is closed."));

    _priority = priority;
  }
コード例 #12
0
 public void close() throws JMSException {
   if (trace) log.trace("close " + this);
   try {
     closeProducer();
   } finally {
     session.removeProducer(this);
   }
 }
コード例 #13
0
  /** Returns the default priority */
  public int getPriority() throws JMSException {
    if (_session == null || _session.isClosed())
      throw new javax.jms.IllegalStateException(L.l("getPriority(): message producer is closed."));

    return _priority;
  }