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

Ask Your Question

Transactions explained


Im writing some education material for Gigaspaces for my customers and I have some question about transactions. I am making assumptions here so please clarify where I am going wrong.

  1. If I reside inside a local space and reads a instance from the space I get a shallow copy. What it means is that the API transforms the SpaceEntry to the expected object type. But the attributes inside the instance points to the same instances as the SpaceEntry does since we are in the sam JVM. Right?

  2. If I do a read I should always clone the instance so I don't change what the SpaceEntries is pointing to right?

  3. If the attribute we are chaning points to a Strin,Integer etc there is no problem since they usually resides in a pool so the acctual contant of the String want change so the SpaceEntry will be intact

So if assuming what I have said so far is true I like to understand how you implement transaction support.

When a transaction is started we want allow for dirty reads/writes. But what happens if I had a List of something in the SpaceEntry and do a read under the influence of a transaction? If I add or delete something from the list want I do a dirty write/read then?

Am I making any sence about this? Would be great do understand how the transaction works in this scenario and also in a local space when using:

  1. Polling container. That would be easy right since you just retrun the object back to the space to negate the take

  2. Event container. A bit tricky since you leave the object in the space but at the same time you cant allow for a change.

So do you guys do a deep copy or something similar when under the influence of a transaction?



{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3534]{quote}

asked 2010-11-03 04:16:07 -0500

magpor gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

I think it would make sense to clone the object before you update it and not when you read it. You should clone only user defined space class fields only (non primitives). In case a transaction rollback, GigaSpaces will restore the primitive fields automatically.

If you don’t want to deal with cloning you can use the full-serialization mode. This will perform a deep clone of every non-primitive field. The down side of this approach is a performance impact.


answered 2010-11-03 20:34:44 -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


Asked: 2010-11-03 04:16:07 -0500

Seen: 66 times

Last updated: Nov 03 '10