Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle Coherence: How to set the timeout on an invoke call in a replicated cache?

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

like image 717
James Avatar asked Apr 16 '12 02:04

James


People also ask

How do I configure the global transaction timeout in Oracle Enterprise Manager?

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.

How to set a transaction timeout in Orion-EJB?

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:

How do I set session timeout for an instance?

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.

How do I set a transaction timeout for each session bean?

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" ).


1 Answers

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:

  1. Switch to a <distributed-cache> scheme in the cache config.
  2. Add a <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).
  3. Use a PriorityProcessor to wrap the EntryProcessor and set the timeout with setRequestTimeoutMillis() before calling invoke(). (Note this is the first thing I tried, but with the wrong kind of cache as it turns out)
like image 197
James Avatar answered Oct 12 '22 23:10

James