Version Number

Hi ,

I read the Version Number Pattern in EJB Design Patterns.

What happens in a System where large no.of clients are interacting and doing millions of transactions where in they will be updating data .since in between the updates the version number will change and they will get the message back that the update has been done and then they have to update the data again.

In this scenario the client has to try lot of times before he actually commits the changes.It will waste a lot of time for the client rite?

please can anyone answer my query.

Thanks

Ravi

[608 byte] By [bharavi2000a] at [2007-9-28 3:15:21]
# 1

Version Number is an optimistic locking pattern for EJB's. Optimistic meaning that the resource is left locked and contention is not assumed to occur frequently, (pessimistic locking would be where the lock is acquired by the first process wishing to make changes and not released until the changes are commited). The assumption with pessimistic is that change contention will occur frequently.

You are correct, in certain scenarios the optimistic scheme can be very problematic however if there really aren't many collisions the optimistic strategy can payoff since the blocking isn't required. The pessimistic strategy could be wasteful when acquiring locks and blocking processes occurs unnecessarily.

swatdbaa at 2007-7-7 22:48:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Hi,

> You are correct, in certain scenarios the optimistic

> scheme can be very problematic however if there really

> aren't many collisions the optimistic strategy can

> payoff since the blocking isn't required. The

> pessimistic strategy could be wasteful when acquiring

> locks and blocking processes occurs unnecessarily.

Moreever the optimistic locking will be better for the Longer Transaction scenario,If the transaction is going for hours and you are using the pessimmistic type then the other client(Transaction) will get fraustated.For more details refer to

http://www.javaworld.com/jw-07-2001/jw-0713-optimism.html

Regards

Vicky

vickyka at 2007-7-7 22:48:13 > top of Java-index,Other Topics,Patterns & OO Design...