TransactionImpl tx = getCurrentTransaction();
if (tx==null) return; // no lock taken without external tx
TransactionState state = tx.getState();
switch (lockType) {
case READ:
state.acquireReadLock(element);
break;
case WRITE:
state.acquireWriteLock(element);
break;
default: throw new IllegalStateException("Unknown lock type "+lockType);