• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

CMT EJB method that never returns

 
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let us consider the following method in a stateless session EJB having Container managed transaction demarcation with a transaction time out of
60 seconds. Due to the infinite loop the method never returns and as per documentation (weblogic) the server will not attempt to abandon the transaction.( But the transaction is marked for a rollback as demanded by EJB specification. ) Hence there is no response or exception received by the client (caller of this EJB method). Is there anyway to make the server abandon the execution of the infinite loop and log or return the Transaction Timeout Exception ?


public int add(int x, int y) {

int k=10;
while(k <100){

}

return x+y;
}
 
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 server will indeed abandon the transaction after 60 seconds, that is the reason for the transaction timeout. Incidentally, the default is 30 seconds for WLS.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"ckarthi"

Please click on the My Profile link above and change your display name to match the JavaRanch Naming Policy of using your real first and real last names.

Thanks

Mark
 
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
Can you point me to the doc which says that the transaction is marked for rollback but not abandoned.
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Link to weblogic documentation
 
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 karthi:
Let us consider the following method in a stateless session EJB having Container managed transaction demarcation with a transaction time out of
60 seconds. Due to the infinite loop the method never returns and as per documentation (weblogic) the server will not attempt to abandon the transaction.( But the transaction is marked for a rollback as demanded by EJB specification. ) Hence there is no response or exception received by the client (caller of this EJB method). Is there anyway to make the server abandon the execution of the infinite loop and log or return the Transaction Timeout Exception ?


public int add(int x, int y) {

int k=10;
while(k <100){

}

return x+y;
}



From the link below I understand the exception is needed thrown but the developer needs to issue the rollback on the ejbcontext

http://support.bea.com/application_content/product_portlets/support_patterns/wls/Investigating_Transaction_Problems_Pattern.html#Transaction_Timeout_and_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
The developer needs to do no rollback after timeout. WebLogic Server will rollback the transaction if it times out - that's the safe thing to do for transactions that take too long. If an attempt is made to do something without a transaction, it will not be allowed. Here is an actual example (taken from a server log file I happen to have) of what WLS sends you on an attempt to update the DB after a transaction timeout.
 
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:
The developer needs to do no rollback after timeout. WebLogic Server will rollback the transaction if it times out - that's the safe thing to do for transactions that take too long. If an attempt is made to do something without a transaction, it will not be allowed. Here is an actual example (taken from a server log file I happen to have) of what WLS sends you on an attempt to update the DB after a transaction timeout.



Great. This is how it should be.
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The transaction may be marked for rollback as it should be. But the server is not returning with the error message "The Transaction has timed out". This is the case with SUN ONE server too.
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic