KickJava   Java API By Example, From Geeks To Geeks.

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


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.net.protocol.tcm.ChannelIDProvider;
7 import com.tc.object.ObjectID;
8 import com.tc.object.TCObject;
9 import com.tc.object.dmi.DmiDescriptor;
10 import com.tc.object.lockmanager.api.LockID;
11 import com.tc.object.session.SessionID;
12
13 import java.util.Collection JavaDoc;
14 import java.util.Map JavaDoc;
15 import java.util.Set JavaDoc;
16
17 /**
18  * Threadlocal based transaction manager interface. Changes go through here to the transaction for the current thread.
19  *
20  * @author steve
21  */

22 public interface ClientTransactionManager {
23
24   /**
25    * begin a thread local transaction Probably change this from class Object to something more specific but it is still
26    * early and I'm not sure what I want here
27    */

28   public void begin(String JavaDoc lock, int lockLevel);
29
30   public boolean tryBegin(String JavaDoc lock, int lockLevel);
31
32   /**
33    * commit a thread local current transaction
34    */

35   public void commit(String JavaDoc lockName) throws UnlockedSharedObjectException;
36
37   /**
38    * When transactions come in from the L2 we use this method to apply them. We will have to get a bit fancier because
39    * we can't apply any changes while we are in any transaction. The first version will not allow apply to happen while
40    * ANY tx is in progress. This is probably not exceptable. We will probably figure something out with the lock manager
41    * where we can accuire a read lock if a field is accessed in a transaction
42    */

43   public void apply(TxnType txType, LockID[] lockIDs, Collection JavaDoc objectChanges, Set JavaDoc lookupObjectIDs, Map JavaDoc newRoots);
44
45   public void createObject(TCObject source);
46
47   public void createRoot(String JavaDoc name, ObjectID id);
48
49   public void literalValueChanged(TCObject source, Object JavaDoc newValue, Object JavaDoc oldValue);
50
51   public void fieldChanged(TCObject source, String JavaDoc classname, String JavaDoc fieldname, Object JavaDoc newValue, int index);
52
53   public void logicalInvoke(TCObject source, int method, String JavaDoc methodName, Object JavaDoc[] parameters);
54
55   public void wait(String JavaDoc lockName, WaitInvocation call, Object JavaDoc object) throws UnlockedSharedObjectException, InterruptedException JavaDoc;
56
57   public void notify(String JavaDoc lockName, boolean all, Object JavaDoc object) throws UnlockedSharedObjectException;
58
59   // For optimistic stuff
60
public ClientTransaction getTransaction() throws UnlockedSharedObjectException;
61
62   public void receivedAcknowledgement(SessionID sessionID, TransactionID requestID);
63
64   public void receivedBatchAcknowledgement(TxnBatchID batchID);
65
66   public void checkWriteAccess(Object JavaDoc context);
67
68   public void addReference(TCObject tco);
69
70   public ChannelIDProvider getChannelIDProvider();
71
72   public boolean isLocked(String JavaDoc lockName);
73
74   public void lock(String JavaDoc lockName, int lockLevel);
75
76   public void unlock(String JavaDoc lockName);
77
78   public boolean isHeldByCurrentThread(String JavaDoc lockName, int lockLevel);
79
80   public int queueLength(String JavaDoc lockName);
81
82   public int waitLength(String JavaDoc lockName);
83
84   public void enableTransactionLogging();
85
86   public void disableTransactionLogging();
87
88   public boolean isTransactionLoggingDisabled();
89
90   public void arrayChanged(TCObject src, int startPos, Object JavaDoc array, int length);
91   
92   public void addDmiDescriptor(DmiDescriptor d);
93
94 }
95
Popular Tags