|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.AbstractPlatformTransactionManager org.springframework.data.gemfire.GemfireTransactionManager
public class GemfireTransactionManager
Local transaction manager for Gemfire Enterprise Fabric (GEF). Provides a PlatformTransactionManager
implementation for a single Gemfire CacheTransactionManager
.
Binds one or multiple Gemfire regions for the specified Cache
to the thread, potentially allowing for one
region per cache model.
This local strategy is an alternative to executing cache operations within JTA transactions. Its advantage is that is able to work in any environment, for example a standalone application or a test suite. It is not able to provide XA transactions, for example to share transactions with data access.
To prevent dirty reads, by default, the cache is configured to return copies rather then direct references for
get
operations. As a workaround, one could use explicitly deep copy objects before making changes
to them to avoid unnecessary copying on every fetch.
CacheTransactionManager
,
Cache.setCopyOnRead(boolean)
,
Region.get(Object)
,
CopyHelper.copy(Object)
,
setCopyOnRead(boolean)
,
AbstractPlatformTransactionManager
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
---|
AbstractPlatformTransactionManager.SuspendedResourcesHolder |
Field Summary |
---|
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
---|
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION |
Constructor Summary | |
---|---|
GemfireTransactionManager()
Creates a new GemfireTransactionManager instance. |
|
GemfireTransactionManager(Cache cache)
Creates a new GemfireTransactionManager instance. |
Method Summary | ||
---|---|---|
void |
afterPropertiesSet()
|
|
protected void |
doBegin(Object transaction,
TransactionDefinition definition)
|
|
protected void |
doCleanupAfterCompletion(Object transaction)
|
|
protected void |
doCommit(DefaultTransactionStatus status)
|
|
protected Object |
doGetTransaction()
|
|
protected void |
doRollback(DefaultTransactionStatus status)
|
|
protected void |
doSetRollbackOnly(DefaultTransactionStatus status)
|
|
Cache |
getCache()
Returns the Cache that this instance manages local transactions for. |
|
Object |
getResourceFactory()
|
|
protected boolean |
isExistingTransaction(Object transaction)
|
|
void |
setCache(Cache cache)
Sets the Cache that this instance manages local transactions for. |
|
void |
setCopyOnRead(boolean copyOnRead)
Indicates whether the cache returns direct references or copies of the objects (default) it manages. |
|
|
setRegion(Region<K,V> region)
Sets the Gemfire Region (as an alternative in setting in the cache directly). |
|
protected boolean |
useSavepointForNestedTransaction()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.transaction.PlatformTransactionManager |
---|
commit, getTransaction, rollback |
Constructor Detail |
---|
public GemfireTransactionManager()
public GemfireTransactionManager(Cache cache)
cache
- Method Detail |
---|
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected Object doGetTransaction() throws TransactionException
doGetTransaction
in class AbstractPlatformTransactionManager
TransactionException
protected boolean isExistingTransaction(Object transaction) throws TransactionException
isExistingTransaction
in class AbstractPlatformTransactionManager
TransactionException
protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException
doBegin
in class AbstractPlatformTransactionManager
TransactionException
protected void doCommit(DefaultTransactionStatus status) throws TransactionException
doCommit
in class AbstractPlatformTransactionManager
TransactionException
protected void doRollback(DefaultTransactionStatus status) throws TransactionException
doRollback
in class AbstractPlatformTransactionManager
TransactionException
protected void doSetRollbackOnly(DefaultTransactionStatus status)
doSetRollbackOnly
in class AbstractPlatformTransactionManager
protected void doCleanupAfterCompletion(Object transaction)
doCleanupAfterCompletion
in class AbstractPlatformTransactionManager
protected final boolean useSavepointForNestedTransaction()
useSavepointForNestedTransaction
in class AbstractPlatformTransactionManager
public Cache getCache()
public void setCache(Cache cache)
cache
- Gemfire cachepublic Object getResourceFactory()
getResourceFactory
in interface ResourceTransactionManager
public <K,V> void setRegion(Region<K,V> region)
Region
(as an alternative in setting in the cache directly).
region
- Gemfire regionpublic void setCopyOnRead(boolean copyOnRead)
CopyHelper.copy(Object)
in which case this setting can be set to false
. However, unless there is a measurable
performance penalty, the recommendation is to keep this setting to true
copyOnRead
- whether copies (default) rather then direct references will be returned on
fetch operations
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |