Package javax.jms

Examples of javax.jms.JMSException


   */
  public final void setJMSPriority(int priority) throws JMSException {
    if (priority >= 0 && priority <= 9)
      momMsg.priority = priority;
    else
      throw new JMSException("Priority of "+ priority +" is not valid"
                             + " (should be an integer between 0 and 9).");
  }
View Full Code Here


    if (momMsg.toId != null) {
      try {
        return Destination.newInstance(momMsg.toId, null, momMsg.toType);
      } catch (Exception exc) {
        // The destination name is unknown
        throw new JMSException(exc.getMessage());
      }
    }
    return null;
  }
View Full Code Here

    if (momMsg.replyToId != null) {
      // The destination name is unknown
      try {
        return Destination.newInstance(momMsg.replyToId, null, momMsg.replyToType);
      } catch (Exception exc) {
        throw new JMSException(exc.getMessage());
      }
    }
    return null;
  }
View Full Code Here

      Destination d = (org.objectweb.joram.client.jms.Destination) replyTo;
      momMsg.setReplyTo(d.getName(), d.getType());
    } catch (NullPointerException npe) {
      momMsg.setReplyTo(null, (byte) 0);
    } catch (ClassCastException cce) {
      throw new JMSException("Destination is not Joram compatible.");
    }
  }
View Full Code Here

   * @exception JMSException  If the delivery mode is incorrect.
   */
  public final void setJMSDeliveryMode(int deliveryMode) throws JMSException {
    if (deliveryMode != javax.jms.DeliveryMode.PERSISTENT &&
        deliveryMode != javax.jms.DeliveryMode.NON_PERSISTENT)
      throw new JMSException("Invalid delivery mode.");

    momMsg.persistent = (deliveryMode == javax.jms.DeliveryMode.PERSISTENT);
  }
View Full Code Here

          momMsg.setProperty(name, new Integer(ConversionHelper.toInt(value)));
        } catch (MessageValueException mE) {
          throw new MessageFormatException(mE.getMessage());
        }
      } else {
        throw new JMSException("Property names with prefix 'JMSX' are reserved.");
      }
    } else if (name.startsWith("JMS_JORAM")) {
      if (propertiesRO)
        throw new MessageNotWriteableException("Can't set property as the message properties are READ-ONLY.");
      momMsg.setProperty(name, value);
    } else if (name.startsWith("JMS")) {
      throw new JMSException("Property names with prefix 'JMS' are  reserved.");
    } else if (name.equalsIgnoreCase("NULL") ||
               name.equalsIgnoreCase("TRUE") ||
               name.equalsIgnoreCase("FALSE") ||
               name.equalsIgnoreCase("NOT") ||
               name.equalsIgnoreCase("AND") ||
               name.equalsIgnoreCase("OR") ||
               name.equalsIgnoreCase("BETWEEN") ||
               name.equalsIgnoreCase("LIKE") ||
               name.equalsIgnoreCase("IN") ||
               name.equalsIgnoreCase("IS") ||
               name.equalsIgnoreCase("ESCAPE")) {
      throw new JMSException("Invalid property name cannot use SQL terminal: " + name);
    } else {
      if (propertiesRO)
        throw new MessageNotWriteableException("Can't set property as the message properties are READ-ONLY.");

      momMsg.setProperty(name, value);
View Full Code Here

        && acknowledgeMode != javax.jms.Session.CLIENT_ACKNOWLEDGE
        && acknowledgeMode != javax.jms.Session.DUPS_OK_ACKNOWLEDGE
        && !(cnx instanceof XAQueueConnection)
        && !(cnx instanceof XATopicConnection)
        && !(cnx instanceof XAConnection))
      throw new JMSException("Can't create a non transacted session with an invalid acknowledge mode.");

    this.ident = cnx.nextSessionId();
    this.cnx = cnx;
    this.transacted = transacted;
    this.acknowledgeMode = acknowledgeMode;
View Full Code Here

      try {
        GetAdminTopicReply reply = (GetAdminTopicReply) requestor.request(new GetAdminTopicRequest());
        if (reply.getId() != null)
          return new Topic(reply.getId());
       
        throw new JMSException("AdminTopic could not be retrieved.");
      } catch (JMSException exc) {
        throw exc;
      } catch (Exception exc) {
        throw new JMSException("AdminTopic could not be retrieved: " + exc);
      }
    }

    try {
      Destination.checkId(name);
View Full Code Here

  public synchronized void unsubscribe(String name) throws JMSException {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "Session.unsubscribe(" + name + ')');

    if (name == null)
      throw new JMSException("Bad subscription name: null");

    checkClosed();
    checkThreadOfControl();
   
    MessageConsumer cons;
    if (consumers != null) {
      for (int i = 0; i < consumers.size(); i++) {
        cons = (MessageConsumer) consumers.get(i);
        if (!cons.queueMode && cons.targetName.equals(name))
          throw new JMSException("Can't delete durable subscription " + name
              + " as long as an active subscriber exists.");
      }
    }
    syncRequest(new ConsumerUnsubRequest(name));
  }
View Full Code Here

   */
  synchronized void checkConsumers(String agentId) throws JMSException {
    for (int j = 0; j < consumers.size(); j++) {
      MessageConsumer cons = (MessageConsumer) consumers.elementAt(j);
      if (agentId.equals(cons.dest.agentId)) {
        throw new JMSException("Consumers still exist for this temp queue.");
      }
    }
  }
View Full Code Here

TOP

Related Classes of javax.jms.JMSException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.