protected ActiveMQSession(ActiveMQConnection theConnection, int theAcknowledgeMode) throws JMSException {
this.connection = theConnection;
this.acknowledgeMode = theAcknowledgeMode;
this.consumers = new CopyOnWriteArrayList();
this.producers = new CopyOnWriteArrayList();
this.consumerIdGenerator = new IdGenerator();
this.transactionIdGenerator = new IdGenerator();
this.temporaryDestinationGenerator = new IdGenerator();
this.packetIdGenerator = new IdGenerator();
this.closed = new SynchronizedBoolean(false);
this.startTransaction = new SynchronizedBoolean(false);
this.sessionId = connection.generateSessionId();
this.startTime = System.currentTimeMillis();
this.deliveredMessages = new DefaultQueueList();