@@ -143,39 +143,43 @@ public void vote(int xid) throws RemoteException {
143143 }
144144
145145 public boolean doCommit (int xid ) throws RemoteException {
146- System .out .println (getName () + " Committing" );
147- crashIf (CrashMode .RM_AFTER_RECEIVING_DECISION );
148- // update pointer file
149- if (currentCommitFile .equals (filename1 )) {
150- xmlPersistor .writeObject (filename2 , pointerFile );
151- currentCommitFile = filename2 ;
152- } else {
153- xmlPersistor .writeObject (filename1 , pointerFile );
154- currentCommitFile = filename1 ;
155- }
156-
157- // destroy transaction-specific state
158- removeTransactionState (xid );
146+ new Thread (() -> {
147+ crashIf (CrashMode .RM_AFTER_RECEIVING_DECISION );
148+ System .out .println (m_name + " Committing" );
149+ // update pointer file
150+ if (currentCommitFile .equals (filename1 )) {
151+ xmlPersistor .writeObject (filename2 , pointerFile );
152+ currentCommitFile = filename2 ;
153+ } else {
154+ xmlPersistor .writeObject (filename1 , pointerFile );
155+ currentCommitFile = filename1 ;
156+ }
159157
160- // unlock
161- globalLock . unlock (xid );
158+ // destroy transaction-specific state
159+ removeTransactionState (xid );
162160
161+ // unlock
162+ globalLock .unlock (xid );
163+ }).start ();
164+
163165 return true ;
164166 }
165167
166168 public boolean abort (int xid ) throws RemoteException {
167- System .out .println (getName () + " aborting" );
168- crashIf (CrashMode .RM_AFTER_RECEIVING_DECISION );
169- if (globalLock .getLockOwner () == xid ) {
170- synchronized (globalState ) {
169+ new Thread (() -> {
170+ System .out .println (m_name + " aborting" );
171+ crashIf (CrashMode .RM_AFTER_RECEIVING_DECISION );
172+ if (globalLock .getLockOwner () == xid ) {
173+ synchronized (globalState ) {
174+ removeTransactionState (xid );
175+ globalState = xmlPersistor .readObject (currentCommitFile );
176+ globalLock .unlock (xid );
177+ }
178+ } else {
171179 removeTransactionState (xid );
172- globalState = xmlPersistor .readObject (currentCommitFile );
173- globalLock .unlock (xid );
180+ globalLock .interruptWaiter (xid );
174181 }
175- } else {
176- removeTransactionState (xid );
177- globalLock .interruptWaiter (xid );
178- }
182+ }).start ();
179183
180184 return true ;
181185 }
0 commit comments