[infinispan-dev] changes introduced by optimistic transactions

Mircea Markus mircea.markus at jboss.com
Mon Aug 1 12:16:57 EDT 2011


Hi,

These is a draft of the config changes I plan to add with ISPN-1131, can you please comment?

1.
<transaction lockingMode="optimistic"/> 
The "lockingMode" attribute can have two values: optimistic(default) and pessimistic. If pessimistic is specified then this hase the same meaning as "useEagerLocking=true" (useEagerLocking to be deprecated).
The fluent API looks as follows:
	- config.fluent().transaction().lockingModeOptimistic();
	- config.fluent().transaction().lockingModePessimistic();
2.
An important restriction introduced by ISPN-1131 is the fact that a cache cannot be used in a mixed mode: i.e. all operations run within transactions or non does.
- by specifying a "transactionManagerLookup" the user marks the cache as transactional. 
- there also is an "autoCommit" attribute: <transaction autoCommit="true"/> 
	- if true (default), then user doesn't have to explicitly start and finish single-operation transactions, but a transaction is started under the hood on user's behalf
        - if false and a call is made out of a transaction's scope then an exception is thrown
        - if the cache is not transactional then autoCommit is ignored
- a cache that supports batch operations is implicitly transactional.  That's because batching is based on transactions.
and the fluent API:
config.fluent().transaction().autoCommit(true);

Cheers,
Mircea


    





More information about the infinispan-dev mailing list