git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@691124 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-09-02 06:46:32 +00:00
parent 47cfa5590b
commit f5703497dd
1 changed files with 3 additions and 0 deletions

View File

@ -296,6 +296,9 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
checkClosedOrFailed();
ensureConnectionInfoSent();
if(!transacted && acknowledgeMode==Session.SESSION_TRANSACTED) {
throw new JMSException("acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session");
}
return new ActiveMQSession(this, getNextSessionId(), transacted ? Session.SESSION_TRANSACTED : (acknowledgeMode == Session.SESSION_TRANSACTED
? Session.AUTO_ACKNOWLEDGE : acknowledgeMode), isDispatchAsync(), isAlwaysSessionAsync());
}