I have a replicated cache running on a number of weblogic nodes which are also running OSB. The cache is started with the server as a startup class. It has a very simple cache of objects that simply track whether they are in use or not with a boolean attribute "available".
From OSB I am making java callouts to the same class, which call "invoke" on the cache with a processor that marks the object as unavailable and then runs Thread.sleep(31000). This is a placeholder for some lengthy processing I want to add later.
What I want to happen, is if the invoke() call takes too long, the process should time out and return or throw an exception. So I have been trying to configure a request timeout of 30000 milliseconds to test this. Unfortunately I cannot figure out how to make this timeout happen.
I have tried:
Wrapping the processor in a PriorityProcessor and calling setRequestTimeout(30000) before invoke()
Adding <request-timeout
>30000</request-timeout
> to the <replicated-scheme/
> element in the cache config
Adding <tasktimeout
>30000</tasktimeout
> to the <replicated-scheme/
> element in the cache config
Adding <guardian-timeout
>30000</guardian-timeout
> to the <replicated-scheme/
> element in the cache config
Creating a tangosol-coherence-override.xml and adding a guardian-timeout <init-param
> to a <service
> element who's "type" matches the service "name" in the cache config
Changing the sleep() call to Thread.sleep(310000) just to see if any out-of-box default will kick in after 5 minutes.
None of these result in any kind of timeout, the processor simply sleeps for however long I told it to and then returns with no error.
Has anyone done something similar before and can give me some advice? It would be very much appreciated.
Thanks
James
You can configure the global transaction timeout as follows: Using the Application Server Control Console (see "Using Oracle Enterprise Manager 10 g Application Server Control" ), you can set the JTAResource MBean attribute transactionTimeout.
In the orion-ejb-jar.xml file you set a session bean transaction timeout with the transaction-timeout attribute of the <session-deployment> element. For example, if you wanted to set the global transaction timeout to 180 seconds, you would do as follows:
Instance administrators can Session Timeout for an instance on the Instance Settings, Security page. Sign in to Oracle Application Express Administration Services. Click Manage Instance. Under Instance Settings, click Security.
You can specify a transaction timeout for each session bean using OC4J-proprietary annotations (see "Using Annotations" ), or using the orion-ejb-jar.xml file (see "Using Deployment XML" ). The session bean transaction timeout overrides the global transaction timeout (see "Configuring a Global Transaction Timeout" ).
OK, so I have the answer, with some help from Tim Middleton.
Basically the replicated cache doesn't support timeouts, and it turns out that it wasn't an appropriate choice for my system anyway!
The solution is:
<distributed-cache
> scheme in the cache config.<thread-count
> element to the scheme with a number > 1 (I chose 10 but it's just however many concurrent instances you want to support).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With