protected ClusterMutex getClusterMutexInternal ( final String mutexName ) { final TransactionOperations transactionOperations = this . getTransactionOperations ( ) ; return transactionOperations . execute ( new TransactionCallback < ClusterMutex > ( ) { @ Override public ClusterMutex doInTransaction ( TransactionStatus status ) { final CacheKey key = CacheKey . build ( CLUSTER_MUTEX_SOURCE , mutexName ) ; ClusterMutex clusterMutex = entityManagerCache . get ( BasePortalJpaDao . PERSISTENCE_UNIT_NAME , key ) ; if ( clusterMutex != null ) { return clusterMutex ; } final NaturalIdQuery < ClusterMutex > query = createNaturalIdQuery ( ClusterMutex . class ) ; query . using ( ClusterMutex_ . name , mutexName ) ; clusterMutex = query . load ( ) ; entityManagerCache . put ( BasePortalJpaDao . PERSISTENCE_UNIT_NAME , key , clusterMutex ) ; return clusterMutex ; } } ) ; }
Retrieves a ClusterMutex in a new TX