Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent - Implementing correct time-outs  RSS feed

 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers!

Your valuable inputs/suggestions are required again. For a requirement in our J2EE based application, we need to implement 'variable time-out' functionality. Let me elaborate on that first -

The application is deployed in WebLogic 9.1 application server. For processing the incoming request, the application may select different algorithms which involve calls to multiple enterprise systems/dbs etc. Each call may take different time to return back. What is required to be implemented here is a functionality which would be able to detect that a particular call is taking _more than_ the normal (thresholds are calculated and need to be configured for each external system call) time and the application should be able to detect this condition. The processing should time-out instantly once the threshold is crossed.

Can anybody please suggest how this can be achieved using Java?

TIA,
Steve
 
krishnamoorthy kitcha
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi stephen

I think your application is very high weight means , you had referred lot of resources .

Can you try your deployment descritor file ejb-jar.xml


In this file we can extend the transaction time settings

<transaction-descriptor>
<trans-timeout-seconds>60</trans-timeout-seconds> </transaction-descriptor>

If you are not satisfied this , reply once agai.
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello 'Krishnamoorthy Kitcha',

The problem is,

- I do not have EJBs but they are POJOs calling external systems
- The time required by each external system call may be different

Could you suggest what could be the possible option to achieve the objective?

Thanks in advance.
~ Steve
 
krishnamoorthy kitcha
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sry to ask

I could not understand , what is your exact problem ??

Where you face the problem ?
your told that Time Out Exception

and can you give your project details
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is - the timeout value for each external call is different (no single global value) and I do not have any EJBs (the calls are in a plain java class). How can this be done?
 
rajesh bala
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried exploring Weblogic "stuck-threads" concept?

The way it works is as follows..
1. Define a work manager and associated stuck-thread time out.
2. So whenever you request is executed via this work-manager, it automatically checks if your request is taking more than the suggested value. If so, it would throw an exception.

you may need to explore more on that to suite your needs. It is available only after 9.x in weblogic

~Rajesh.B
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done something like this before. We had a partner system call that sometimes hung for minutes.

In Java 5 or later Future can do a cleaner job than this. I got the max time for each call from configuration. If you need dynamic smarts, you could add tracking for how long the last "n" calls took and set the timeout to 150% the rolling average or some clever algorithm.

Note that I showed no attempt to halt the other thread. It runs to completion no matter how long it takes. Stopping a thread that's hung up can be pretty much impossible.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!