public LockFactory( Cache<String, Metadata> metadataCache ) {
this.metadataCache = metadataCache;
if (this.metadataCache != null) {
infinispanLocks = metadataCache.getCacheConfiguration().transaction().transactionMode() != TransactionMode.NON_TRANSACTIONAL
&& metadataCache.getCacheConfiguration().transaction().lockingMode() == LockingMode.PESSIMISTIC;
namedLocks = !infinispanLocks && !metadataCache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new NamedLocks() : null;
} else {
namedLocks = null;
infinispanLocks = false;
}
}