jsr107 / jsr107spec

JSR107 Cache Specification
Apache License 2.0
415 stars 164 forks source link

local Transactions via javax.tx.UserTransaction lacks setIsolationLevel() #10

Closed ben-cotton closed 13 years ago

ben-cotton commented 13 years ago

Chapter 5 specifies the use of javax.transaction.UserTransaciton (via CacheManager.getUsertTransaction() as a mechanism to manage local transactions. Ideal for global transactions, UserTransaction is a bit of a mis-fit for local transactions. Other transaction-savvy Java APIs (e.g. JDBC) do not use UserTransaction for local transactions. UserTransaction does not provide an API bridge to a setTransactionIsolationLevel() capability. JDBC uses javax.sql.Connection to manage local transaction operations, including setTransactionisolationLevel(). Also, Oracle's Coherence Java Cache product has exactly what we should consider using for JSR 107 ... see http://download.oracle.com/docs/cd/E15357_01/coh.360/e18814/com/tangosol/coherence/transaction/Connection.html

ben-cotton commented 13 years ago

details discussed here https://groups.google.com/forum/#!topic/jsr107/EhIS-pi-mFI

ben-cotton commented 13 years ago

did not mean to close!

ben-cotton commented 13 years ago

Issue moved to https://github.com/jsr107/jsr107spec/issues/16

gregrluck commented 13 years ago

We discussed this in a phone call.

The API would be:

CacheManager.getCache(String cacheName, IsolationLevel isolationLevel);

In a Cache there could be different threads using different isolation levels. That would be achieved by using the above method. In effect here would be multiple views of the same backing cache exhibiting different isolation level behaviours.

Having said that, the use case for this is extremely rare. As a result having canvassed other EG members it seem unlikely that anyone will be implementing this. We have spec'ed the API and we could add this into a later version of the spec if there is sufficient demand.

The use case that does exist is on Wall Street however these uses cases are using KX and C code - they are not even on Java. Even if we added the feature it is unlikely it would be used.

Finally we now also have the Cache.unwrap method. If an implementation such as Ehcache offers this feature then you could use it by getting at Ehcache. We do support today UnlockedReadsView which will provide a dirty reads view of a transaction cache, which is close to the desired functionality.