Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

How to configure defaultReadTimeout for LocalCache?

Hello,

For a "normal" space proxy one could set a property GigaSpaceFactoryBean.defaultReadTimeout to define how long a read operation could wait for an object locked by another transaction before returning.

How could I set this property for a LocalCache (or should I not attempt to set it at all)? What is a default timeout when LocalCache attempts to read an object from the underlying space, and the object is locked by another transaction? How is it working when a LocalCache is connected to a partitioned space, when a routing key is different from the primary object ID?

asked 2017-03-02 06:00:05 -0500

Alexey Serdyuk gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Default timeout when LocalCache is ZERO. You should not set it. If no matching found the master space will be searched.

Transactional operations are always executed on the master space. It also removes any old copies from the local cache. This is done to provide transactional consistency. Once a transaction is committed, the data is updated within the local cache according to the update policy.

answered 2017-03-09 14:30:09 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hello Shay,

thank you for an explanation, but there is still one point I do not understand. Suppose an application attempts to get an object from LocalCache. If the object is there it is returned immediately, if the object is not cached yet, GigaSpace attempts to load an object from the remote space. If at this moment the object is exclusively locked in the remote space by another transaction, what exactly happens? Would LocalCache return null, or would it return the last committed version from the remote space, or would it wait for the object to be unlocked in the remote space?

Alexey Serdyuk gravatar imageAlexey Serdyuk ( 2017-03-16 02:04:38 -0500 )edit
0

If the object is locked under a transaction a local cache will be updated when the transaction will be committed.

If you perform a read using a proxy running a local cache you may: - get the last committed version in case the object been already read and loaded into the local cache but not evicted yet - a null - in case the object has not been found within the local cache but its locked in the master where the timeout parameter passed used was ZERO - the committed value - in case the object has not been found within the local cache but its locked in the master where the timeout used was long enough to wait for the transaction to be completed. readIfExists should be considered.

As you see - a system using local cache and transactions would require some attention.

answered 2017-03-16 08:33:36 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-02 06:00:05 -0500

Seen: 598 times

Last updated: Mar 16