timeout = ctx.getOptionOverrides().getLockAcquisitionTimeout();
}
try
{
TransactionWorkspace<?, ?> workspace = getTransactionWorkspace(gtx);
TransactionEntry te = cache.getTransactionTable().get(gtx);
if (log.isDebugEnabled()) log.debug("Locking nodes in transaction workspace for GlobalTransaction " + gtx);
for (WorkspaceNode workspaceNode : workspace.getNodes().values())
{
NodeSPI node = workspaceNode.getNode();
boolean isWriteLockNeeded = workspaceNode.isDirty() || (workspaceNode.isChildrenModified() && (configuration.isLockParentForChildInsertRemove() || node.isLockForChildInsertRemove()));
boolean acquired = node.getLock().acquire(gtx, timeout, isWriteLockNeeded ? WRITE : READ);
if (acquired)
{
if (trace) log.trace("Acquired lock on node " + node.getFqn());
te.addLock(node.getLock());
}
else
{
throw new CacheException("Unable to acquire lock on node " + node.getFqn());
}