• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on EJB Transactions

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a transaction, say Trans1, which has 3 transactions ionternally, say, Trans2,Trans3,Trans4.

The transaction time out that I set on server is 5 mins.

what happens if the Trans 2 takes 3 mins and Trans 3 takes 3 mins? Is it gonna timeout the EJB Trans1?

I am using IBM Webspshere application server.

and is these trasnaction rules are vendor dependent?

Thanks,
-Visu
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The transaction timeout relates to a transaction. If a transaction is suspended, the clock stops ticking, so to speak, and will restart when the transaction resumes.

I won't expect five minutes for a timeout as you need to keep transactions small. Something like 30 seconds should be sufficient as a default.
 
vishwa venkat
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for clarification. One of the EJB constitutes a JMS transaction which will timeout after 4 minutes. so we made the global transaction time out on server to 5mins to take care of that.Let me know if you have any ideas on this too..

thanks a lot.
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't JMS(MDB) to be used for "A"synchronous processing ? If the processing is going to be synchronous wont it be better using stateless session bean ? Correct me if otherwise.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not clear what is happening. I think that the requirement is for a JMS message and the message listener (probably an MDB) must be in the same transaction.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by visu Ramana:
I have a transaction, say Trans1, which has 3 transactions ionternally, say, Trans2,Trans3,Trans4.

The transaction time out that I set on server is 5 mins.

what happens if the Trans 2 takes 3 mins and Trans 3 takes 3 mins? Is it gonna timeout the EJB Trans1?

I am using IBM Webspshere application server.

and is these trasnaction rules are vendor dependent?

Thanks,
-Visu



How can transaction 1 have 3 transaction internall -Nested transaction are not supported in J2EE.
 
vishwa venkat
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nested transactions are supported in J2ee. and coming to the requirement,

We are doing Sunchronous JMS transaction.

So we created two session bean methods one for send and another for receive messages (in BEAN2)and these methods are called from another session bean(say BEAN1)

so BEAN1 method starts transaction and sends a message and recieves message withing the same method. and send ,receive methods open their individual transaction contexts.

Since receive method might take 4 minutes, since we are waiting for response from the JMS Queue, we set the transaction timeout to be 5 mins.

Thanks for carrying the discussion..
 
vishwa venkat
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NO MDBs used..it is a Synchronous transaction, we can say it is a Psuedo Synchronous transaction.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nested transactions are supported in J2ee. and coming to the requirement,


Nested transactions are disallowed by the EJB spec. All transactions are flat and no compliant EJB server will support nested transactions.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We are doing Sunchronous JMS transaction.


JMS is meant for aynchronous messaging. The synchronous receive() method blocks until a message is produced, the timeout value, if specified, elapses or the application is closed. I strongly recommend that you avoid using blocking receive() calls on the server side because a synchronous receive() call consumes resources for the entire duration that the call is blocked.

Also, consider the effect on the client which might be waiting for up to five minutes for a response.

See if you can redesign your app for asyncronous messaging. Doing it this way, when methods are received asynchronously, the application is notified using a message listener only when a message has been produced. So, no resources are consumed waiting for a message.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roger Chung-Wee:

Nested transactions are disallowed by the EJB spec. All transactions are flat and no compliant EJB server will support nested transactions.



Thanks. I was shocked to hear that nested transaction is supported in J2EE.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic