use of jakarta.jms.JMSRuntimeException in project openmq by eclipse-ee4j.
the class JMSContextImpl method setClientID.
@Override
public void setClientID(String clientID) {
// this method is not permitted in the Java EE web or EJB containers
if (containerType == ContainerType.JavaEE_Web_or_EJB) {
// "This method may not be called in a Java EE web or EJB container"
String errorString = AdministeredObject.cr.getKString(ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
ExceptionHandler.throwJMSRuntimeException(jmsre);
}
// may throw JMSRuntimeException
checkNotClosed();
// may throw IllegalStateRuntimeException
checkSetClientIDAllowed();
// may throw InvalidClientIDRuntimeException
checkClientID(clientID);
if (connection instanceof ContextableConnection) {
((ContextableConnection) connection)._setClientIDForContext(clientID);
} else {
// for debugging
throw new RuntimeException("Not yet implemented for " + connection.getClass());
}
disallowSetClientID();
}
use of jakarta.jms.JMSRuntimeException in project openmq by eclipse-ee4j.
the class JMSContextImpl method validateSessionMode.
private void validateSessionMode(int sessionMode) {
if (sessionMode != JMSContext.AUTO_ACKNOWLEDGE && sessionMode != JMSContext.CLIENT_ACKNOWLEDGE && sessionMode != JMSContext.DUPS_OK_ACKNOWLEDGE && sessionMode != JMSContext.SESSION_TRANSACTED) {
// "Invalid session mode {0}"
String errorString = AdministeredObject.cr.getKString(ClientResources.X_INVALID_SESSION_MODE, sessionMode);
JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, ClientResources.X_INVALID_SESSION_MODE);
ExceptionHandler.throwJMSRuntimeException(jmsre);
}
}
use of jakarta.jms.JMSRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method setAsync.
@Override
public JMSProducer setAsync(CompletionListener completionListener) {
// this method is not permitted in the Java EE web or EJB containers
if (contextImpl.getContainerType() == ContainerType.JavaEE_Web_or_EJB) {
// "This method may not be called in a Java EE web or EJB container"
String errorString = AdministeredObject.cr.getKString(ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, ClientResources.X_FORBIDDEN_IN_JAVAEE_WEB_EJB);
ExceptionHandler.throwJMSRuntimeException(jmsre);
}
contextImpl.checkNotClosed();
this.completionListener = completionListener;
return this;
}
use of jakarta.jms.JMSRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method setDeliveryMode.
@Override
public JMSProducer setDeliveryMode(int deliveryMode) {
contextImpl.checkNotClosed();
if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) {
String errorString = AdministeredObject.cr.getKString(AdministeredObject.cr.X_INVALID_DELIVERY_PARAM, "DeliveryMode", String.valueOf(deliveryMode));
JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, AdministeredObject.cr.X_INVALID_DELIVERY_PARAM);
ExceptionHandler.throwJMSRuntimeException(jmsre);
}
this.deliveryMode = deliveryMode;
return this;
}
use of jakarta.jms.JMSRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method setPriority.
@Override
public JMSProducer setPriority(int priority) {
contextImpl.checkNotClosed();
if (priority < 0 || priority > 9) {
String errorString = AdministeredObject.cr.getKString(AdministeredObject.cr.X_INVALID_DELIVERY_PARAM, "DeliveryPriority", String.valueOf(priority));
JMSRuntimeException jmsre = new com.sun.messaging.jms.MQRuntimeException(errorString, AdministeredObject.cr.X_INVALID_DELIVERY_PARAM);
ExceptionHandler.throwJMSRuntimeException(jmsre);
}
this.priority = priority;
return this;
}
Aggregations