01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.tx;
05:
06: import com.tc.object.lockmanager.api.LockID;
07:
08: import java.util.ArrayList;
09: import java.util.Arrays;
10: import java.util.List;
11:
12: public class TransactionContextImpl implements TransactionContext {
13: TxnType type;
14: LockID lockID;
15: private LockID[] lockIDs;
16:
17: public TransactionContextImpl(LockID lockID, TxnType type,
18: LockID[] lockIDs) {
19: this .type = type;
20: this .lockID = lockID;
21: this .lockIDs = lockIDs;
22: }
23:
24: public TxnType getType() {
25: return type;
26: }
27:
28: public LockID getLockID() {
29: return lockID;
30: }
31:
32: public LockID[] getAllLockIDs() {
33: return lockIDs;
34: }
35:
36: public void removeLock(LockID id) {
37: List list = new ArrayList(Arrays.asList(lockIDs));
38: list.remove(id);
39: lockIDs = new LockID[list.size()];
40: for (int i = 0; i < lockIDs.length; i++) {
41: lockIDs[i] = (LockID) list.get(i);
42: }
43: }
44: }
|