public int offer(SearchOffer anOffer) { OpInfo myInfo = anOffer.getInfo(); // Try the lock LockMgr myMgr = TxnLocks.getLockMgr(myInfo.getType()); TxnLock myLock = myMgr.getLock(myInfo.getOID()); int myResult; synchronized (myLock) { myResult = myLock.acquire(theTxn, TxnLock.READ, null, null, false); } if (myResult == TxnLock.SUCCESS) { if (keepLock) { /* Need to track the lock under the transaction */ try { theTxn.add(new EntryTxnOp(TxnLock.READ, myInfo, myLock)); } catch (TransactionException aTE) { myLock.release(theTxn, TxnLock.READ); theFailure = aTE; return STOP; } } else { /* No need to track this lock, we were just testing so we can release it now */ myLock.release(theTxn, TxnLock.READ); } theEntry = anOffer.getEntry(); } return STOP; }
public void addOps(final Collection<? extends OpInfo> infos) { if (infos == null) return; for (final OpInfo info : infos) { put(info.cInfo().getDelegateClassName(), info); } }