/** * Asserts a {@link javax.jms.CompletionListener} is not calling from its own {@link javax.jms.Connection} or from * a {@link javax.jms.MessageProducer} . * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one CompletionListener be called at a time. In other words, * CompletionListener calling is single-threaded. * * @see javax.jms.Connection#close() * @see javax.jms.MessageProducer#close() */ public void assertNotCompletionListenerThread() throws javax.jms.IllegalStateException { if (completionListenerThread == Thread.currentThread()) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromCompletionListener(); } }
/** * Asserts a {@link javax.jms.CompletionListener} is not calling from its own {@link javax.jms.JMSContext}. * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one CompletionListener be called at a time. In other words, * CompletionListener calling is single-threaded. * * @see javax.jms.JMSContext#close() * @see javax.jms.JMSContext#stop() * @see javax.jms.JMSContext#commit() * @see javax.jms.JMSContext#rollback() */ public void assertNotCompletionListenerThreadRuntime() { if (completionListenerThread == Thread.currentThread()) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromCompletionListenerRuntime(); } }
/** * Asserts a {@link javax.jms.MessageListener} is not calling from its own {@link javax.jms.Connection} or * {@link javax.jms.MessageConsumer}. * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one MessageListener be called at a time. In other words, * MessageListener calling is single-threaded. * * @see javax.jms.Connection#close() * @see javax.jms.MessageConsumer#close() */ public void assertNotMessageListenerThread() throws IllegalStateException { if (messageListenerThreads.contains(Thread.currentThread().getId())) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromListener(); } }
private void checkProperty(final String name) throws JMSException { if (propertiesReadOnly) { if (name.equals(ActiveMQJMSConstants.JMS_ACTIVEMQ_INPUT_STREAM)) { throw new MessageNotWriteableException("You cannot set the Input Stream on received messages. Did you mean " + ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM + " or " + ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM + "?"); } else { throw ActiveMQJMSClientBundle.BUNDLE.messageNotWritable(); } } if (name == null) { throw ActiveMQJMSClientBundle.BUNDLE.nullArgumentNotAllowed("property"); } if (name.equals("")) { throw new IllegalArgumentException("The name of a property must not be an empty String."); } if (!isValidJavaIdentifier(name)) { throw ActiveMQJMSClientBundle.BUNDLE.invalidJavaIdentifier(name); } if (ActiveMQMessage.reservedIdentifiers.contains(name)) { throw new JMSRuntimeException("The property name '" + name + "' is reserved due to selector syntax."); } if (name.startsWith("JMS_ACTIVEMQ")) { throw new JMSRuntimeException("The property name '" + name + "' is illegal since it starts with JMS_ACTIVEMQ"); } }
throw ActiveMQJMSClientBundle.BUNDLE.invalidSubscriptionName(); throw ActiveMQJMSClientBundle.BUNDLE.destinationDoesNotExist(dest.getSimpleAddress());
@Override public void setDeliveryMode(final int deliveryMode) throws JMSException { checkClosed(); if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) { throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode); } defaultDeliveryMode = deliveryMode; }
protected void checkRead() throws JMSException { if (!readOnly) { throw ActiveMQJMSClientBundle.BUNDLE.messageNotReadable(); } }
/** * Asserts a {@link javax.jms.MessageListener} is not calling from its own {@link javax.jms.JMSContext}. * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one MessageListener be called at a time. In other words, * MessageListener calling is single-threaded. * * @see javax.jms.JMSContext#close() * @see javax.jms.JMSContext#stop() */ public void assertNotMessageListenerThreadRuntime() { if (messageListenerThreads.contains(Thread.currentThread().getId())) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromListenerRuntime(); } }
throw JMSExceptionHelper.convertFromActiveMQException(ActiveMQJMSClientBundle.BUNDLE.invalidFilter(e, new SimpleString(filterString)));
private void checkProperty(final String name) throws JMSException { if (propertiesReadOnly) { if (name != null && name.equals(ActiveMQJMSConstants.JMS_ACTIVEMQ_INPUT_STREAM)) { throw new MessageNotWriteableException("You cannot set the Input Stream on received messages. Did you mean " + ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM + " or " + ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM + "?"); } else { throw ActiveMQJMSClientBundle.BUNDLE.messageNotWritable(); } } if (name == null) { throw ActiveMQJMSClientBundle.BUNDLE.nullArgumentNotAllowed("property"); } if (name.equals("")) { throw new IllegalArgumentException("The name of a property must not be an empty String."); } if (!isValidJavaIdentifier(name)) { throw ActiveMQJMSClientBundle.BUNDLE.invalidJavaIdentifier(name); } if (ActiveMQMessage.reservedIdentifiers.contains(name)) { throw new JMSRuntimeException("The property name '" + name + "' is reserved due to selector syntax."); } if (name.startsWith("JMS_ACTIVEMQ")) { throw new JMSRuntimeException("The property name '" + name + "' is illegal since it starts with JMS_ACTIVEMQ"); } }
throw ActiveMQJMSClientBundle.BUNDLE.invalidSubscriptionName(); throw ActiveMQJMSClientBundle.BUNDLE.destinationDoesNotExist(dest.getSimpleAddress());
@Override public void setJMSDeliveryMode(final int deliveryMode) throws JMSException { if (deliveryMode == DeliveryMode.PERSISTENT) { message.setDurable(true); } else if (deliveryMode == DeliveryMode.NON_PERSISTENT) { message.setDurable(false); } else { throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode); } }
protected void checkRead() throws JMSException { if (!readOnly) { throw ActiveMQJMSClientBundle.BUNDLE.messageNotReadable(); } }
/** * Asserts a {@link javax.jms.MessageListener} is not calling from its own {@link javax.jms.JMSContext}. * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one MessageListener be called at a time. In other words, * MessageListener calling is single-threaded. * * @see javax.jms.JMSContext#close() * @see javax.jms.JMSContext#stop() */ public void assertNotMessageListenerThreadRuntime() { if (messageListenerThreads.contains(Thread.currentThread().getId())) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromListenerRuntime(); } }
throw JMSExceptionHelper.convertFromActiveMQException(ActiveMQJMSClientBundle.BUNDLE.invalidFilter(e, new SimpleString(filterString)));
private void checkProperty(final String name) throws JMSException { if (propertiesReadOnly) { if (name.equals(ActiveMQJMSConstants.JMS_ACTIVEMQ_INPUT_STREAM)) { throw new MessageNotWriteableException("You cannot set the Input Stream on received messages. Did you mean " + ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM + " or " + ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM + "?"); } else { throw ActiveMQJMSClientBundle.BUNDLE.messageNotWritable(); } } if (name == null) { throw ActiveMQJMSClientBundle.BUNDLE.nullArgumentNotAllowed("property"); } if (name.equals("")) { throw new IllegalArgumentException("The name of a property must not be an empty String."); } if (!isValidJavaIdentifier(name)) { throw ActiveMQJMSClientBundle.BUNDLE.invalidJavaIdentifier(name); } if (ActiveMQMessage.reservedIdentifiers.contains(name)) { throw new JMSRuntimeException("The property name '" + name + "' is reserved due to selector syntax."); } if (name.startsWith("JMS_ACTIVEMQ")) { throw new JMSRuntimeException("The property name '" + name + "' is illegal since it starts with JMS_ACTIVEMQ"); } }
throw ActiveMQJMSClientBundle.BUNDLE.invalidSubscriptionName(); throw ActiveMQJMSClientBundle.BUNDLE.destinationDoesNotExist(dest.getSimpleAddress());
@Override public void setDeliveryMode(final int deliveryMode) throws JMSException { checkClosed(); if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) { throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode); } defaultDeliveryMode = deliveryMode; }
protected void checkRead() throws JMSException { if (!readOnly) { throw ActiveMQJMSClientBundle.BUNDLE.messageNotReadable(); } }
/** * Asserts a {@link javax.jms.MessageListener} is not calling from its own {@link javax.jms.JMSContext}. * <p> * Note that the code must work without any need for further synchronization, as there is the * requirement that only one MessageListener be called at a time. In other words, * MessageListener calling is single-threaded. * * @see javax.jms.JMSContext#close() * @see javax.jms.JMSContext#stop() */ public void assertNotMessageListenerThreadRuntime() { if (messageListenerThreads.contains(Thread.currentThread().getId())) { throw ActiveMQJMSClientBundle.BUNDLE.callingMethodFromListenerRuntime(); } }