File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Does a transacted session block? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Does a transacted session block?" Watch "Does a transacted session block?" New topic
Author

Does a transacted session block?

Balamaci Serban
Ranch Hand

Joined: Mar 16, 2005
Posts: 49
What i mean is that with
QueueSession session = conn.createQueueSession(true, -1);
u create a transacted session. But what does that mean besides that u could commit or rollback a series of messages? It also mean that we have a serial order for those messages. It means that till i commit the session i guess i'm guaranted that no other messages will interviene with my the group i;m creating now. So does that imply some sort of locking and other threads trying to start a transacted session have to wait for this one to finish? When does the lock actualy begin, because we don't pass a destination in the createQueueSession, and there shouldn't be any blocking with threads accesing different destinations.

So does a lock start with QueueSender senderJMS = session.createSender(queue); and other threads trying to send to that destination have to wait? Or it doesn;t actually imply that they block, and only when we call commit() on the session the whole group is sent but as a whole and it doesn't matter who starts first a transacted session as they never block each other even on the same destination, and only the first who calls commit gets his group of messages there first.
[ June 10, 2005: Message edited by: Balamaci Serban ]
Jeremy Hsu
Ranch Hand

Joined: Mar 28, 2005
Posts: 79
It simply means that it makes sure the message is delivered to the message queue. However, unless you committed your current transaction, those message will not be delivered to message consumers. In other words, those messages stays in the message queue until you committed your current transaction. If you abort, those message will be removed from queues.
[ June 13, 2005: Message edited by: Jeremy Hsu ]
Balamaci Serban
Ranch Hand

Joined: Mar 16, 2005
Posts: 49
Thanks, i guess it had to be so, after all, u use JMS to get away from having to block waiting for a message to be delivered.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Does a transacted session block?
 
Similar Threads
MDB deployment on JBoss
My Choices
Multithreaded JMS application
Why would the container create more instances of the same MDB
Synchronous or Asynchronous Method?