use of com.sun.messaging.jmq.jmsservice.JMSService.SessionAckMode in project openmq by eclipse-ee4j.
the class DirectConnection method _createSessionId.
// ///////////////////////////////////////////////////////////////////////
// end private support for jakarta.jms.Connection for RA use
// ///////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////
// MQ methods
// ///////////////////////////////////////////////////////////////////////
/**
* Create a session with the jmsservice and return a sessionId. Used by the methods implementing jakarta.jms.Connection,
* jakarta.jms.QueueConnection, and jakarta.jms.TopicConnection
*
* @param connectionId The connectionId in which the session is being created.
* @param acknowledgeMode The acknowledgment mode being used
*
* @return The sessionId to be used by the DirectSession object that is returned by the JMS API method
*
* @throws JMSException if any JMS server error occurred
*/
private long _createSessionId(long connectionId, boolean isTransacted, int acknowledgeMode) throws JMSException {
JMSServiceReply reply;
long sessionId = 0L;
SessionAckMode ackMode = this._getSessionAckModeFromSessionParams(isTransacted, acknowledgeMode);
try {
reply = jmsservice.createSession(connectionId, ackMode);
try {
sessionId = reply.getJMQSessionID();
} catch (NoSuchFieldException nsfe) {
String exerrmsg = _lgrMID_EXC + "JMSServiceException:Missing JMQSessionID";
JMSException jmse = new JMSException(exerrmsg);
jmse.initCause(nsfe);
_loggerJC.severe(exerrmsg);
throw jmse;
}
} catch (JMSServiceException jse) {
JMSServiceReply.Status status = jse.getJMSServiceReply().getStatus();
String failure_cause;
switch(status) {
case BAD_REQUEST:
failure_cause = "invalid acknowledgment mode.";
break;
case NOT_ALLOWED:
failure_cause = "acknowledgmentmode is not allowed.";
break;
default:
failure_cause = "unkown JMSService server error.";
}
String exerrmsg = "createSession on JMSService:" + jmsservice.getJMSServiceID() + " failed for connectionId:" + connectionId + " due to " + failure_cause;
_loggerJC.severe(exerrmsg);
JMSException jmsse = new JMSException(exerrmsg);
jmsse.initCause(jse);
throw jmsse;
}
return sessionId;
}
use of com.sun.messaging.jmq.jmsservice.JMSService.SessionAckMode in project openmq by eclipse-ee4j.
the class DirectConnection method createQueueSession.
/**
* Create a JMS QueueSession in this JMS QueueConnection
*/
@Override
public QueueSession createQueueSession(boolean isTransacted, int acknowledgeMode) throws JMSException {
_loggerJC.fine(_lgrMID_INF + "connectionId=" + connectionId + ":" + "createQueueSession():" + "isTransacted=" + isTransacted + ":" + "acknowledgeMode=" + acknowledgeMode);
_checkIfClosed("createQueueSession():");
checkSessionsAllowed("createQueueSession():");
this.setUsed();
SessionAckMode ackMode;
long sessionId;
if (ResourceAdapter._isFixCR6760301()) {
// override args
boolean actualTransactedArg = overrideTransacted(isTransacted);
int actualAcknowledgeModeArg = overrideAcknowledgeMode(acknowledgeMode);
sessionId = _createSessionId(connectionId, actualTransactedArg, actualAcknowledgeModeArg);
ackMode = _getSessionAckModeFromSessionParams(actualTransactedArg, actualAcknowledgeModeArg);
} else {
boolean isTransactedOverride = !this.isManaged() && isTransacted;
sessionId = _createSessionId(connectionId, isTransactedOverride, acknowledgeMode);
ackMode = _getSessionAckModeFromSessionParams(isTransactedOverride, acknowledgeMode);
}
DirectSession ds = new DirectQueueSession(this, this.jmsservice, sessionId, ackMode);
this.addSession(ds);
return ds;
}
use of com.sun.messaging.jmq.jmsservice.JMSService.SessionAckMode in project openmq by eclipse-ee4j.
the class DirectConnection method createSessionForRAEndpoint.
/**
* Create a JMS Session in this JMS Connection on which a RAEndpoint can consume messages
*
* @return The JMSSession
*/
public Session createSessionForRAEndpoint() throws JMSException {
_loggerJC.fine(_lgrMID_INF + "connectionId=" + connectionId + ":" + "createSessionForRAEndpoint():");
_checkIfClosed("createSession():");
this.setUsed();
boolean actualTransactedArg = false;
int actualAcknowledgeModeArg = Session.CLIENT_ACKNOWLEDGE;
long sessionId = _createSessionId(connectionId, actualTransactedArg, actualAcknowledgeModeArg);
SessionAckMode ackMode = _getSessionAckModeFromSessionParams(actualTransactedArg, actualAcknowledgeModeArg);
DirectSession ds = new DirectSession(this, this.jmsservice, sessionId, ackMode);
this.addSession(ds);
return ds;
}
use of com.sun.messaging.jmq.jmsservice.JMSService.SessionAckMode in project openmq by eclipse-ee4j.
the class DirectConnection method createTopicSession.
/**
* Create a JMS TopicSession in this JMS QueueConnection
*/
@Override
public TopicSession createTopicSession(boolean isTransacted, int acknowledgeMode) throws JMSException {
_loggerJC.fine(_lgrMID_INF + "connectionId=" + connectionId + ":" + "createTopicSession():" + "isTransacted=" + isTransacted + ":" + "acknowledgeMode=" + acknowledgeMode);
_checkIfClosed("createTopicSession():");
checkSessionsAllowed("createTopicSession():");
this.setUsed();
SessionAckMode ackMode;
long sessionId;
if (ResourceAdapter._isFixCR6760301()) {
// override args
boolean actualTransactedArg = overrideTransacted(isTransacted);
int actualAcknowledgeModeArg = overrideAcknowledgeMode(acknowledgeMode);
sessionId = _createSessionId(connectionId, actualTransactedArg, actualAcknowledgeModeArg);
ackMode = _getSessionAckModeFromSessionParams(actualTransactedArg, actualAcknowledgeModeArg);
} else {
boolean isTransactedOverride = !this.isManaged() && isTransacted;
sessionId = _createSessionId(connectionId, isTransactedOverride, acknowledgeMode);
ackMode = _getSessionAckModeFromSessionParams(isTransactedOverride, acknowledgeMode);
}
DirectSession ds = new DirectTopicSession(this, this.jmsservice, sessionId, ackMode);
this.addSession(ds);
return ds;
}
use of com.sun.messaging.jmq.jmsservice.JMSService.SessionAckMode in project openmq by eclipse-ee4j.
the class DirectConnection method createSession.
/**
* Create a JMS Session in this JMS Connection
*
* @param isTransacted Indicates whether the Session is transacted or not.
* @param acknowledgeMode The Session acknowledgement mode
*
* @return The JMSSession
*/
@Override
public Session createSession(boolean isTransacted, int acknowledgeMode) throws JMSException {
_loggerJC.fine(_lgrMID_INF + "connectionId=" + connectionId + ":" + "createSession():" + "isTransacted=" + isTransacted + ":" + "acknowledgeMode=" + acknowledgeMode);
_checkIfClosed("createSession():");
checkSessionsAllowed("createSession():");
this.setUsed();
SessionAckMode ackMode;
long sessionId;
if (ResourceAdapter._isFixCR6760301()) {
boolean actualTransactedArg = overrideTransacted(isTransacted);
int actualAcknowledgeModeArg = overrideAcknowledgeMode(acknowledgeMode);
sessionId = _createSessionId(connectionId, actualTransactedArg, actualAcknowledgeModeArg);
ackMode = _getSessionAckModeFromSessionParams(actualTransactedArg, actualAcknowledgeModeArg);
} else {
boolean isTransactedOverride = !this.isManaged() && isTransacted;
sessionId = _createSessionId(connectionId, isTransactedOverride, acknowledgeMode);
ackMode = _getSessionAckModeFromSessionParams(isTransactedOverride, acknowledgeMode);
}
DirectSession ds = (this.isManaged() ? new DirectTransactionManagedSession(this, this.jmsservice, sessionId, ackMode) : new DirectSession(this, this.jmsservice, sessionId, ackMode));
this.addSession(ds);
return ds;
}
Aggregations