KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > tx > TransactionContext


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.tx;
5
6 import com.tc.object.lockmanager.api.LockID;
7
8 import java.util.ArrayList JavaDoc;
9 import java.util.Arrays JavaDoc;
10 import java.util.List JavaDoc;
11
12 public class TransactionContext {
13   TxnType type;
14   LockID lockID;
15   private LockID[] lockIDs;
16
17   public TransactionContext(LockID lockID, TxnType type, LockID[] lockIDs) {
18     this.type = type;
19     this.lockID = lockID;
20     this.lockIDs = lockIDs;
21   }
22
23   public TxnType getType() {
24     return type;
25   }
26
27   public LockID getLockID() {
28     return lockID;
29   }
30
31   public LockID[] getAllLockIDs() {
32     return lockIDs;
33   }
34
35   public void removeLock(LockID id) {
36     List JavaDoc list = new ArrayList JavaDoc(Arrays.asList(lockIDs));
37     list.remove(id);
38     lockIDs = new LockID[list.size()];
39     for (int i=0; i<lockIDs.length; i++) {
40       lockIDs[i] = (LockID)list.get(i);
41     }
42   }
43 }
Popular Tags