[jboss-svn-commits] JBL Code SVN: r37802 - labs/jbosstm/branches/JBOSSTS_4_16/atsintegration/tests/classes/com/arjuna/ats/jta/distributed.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Dec 14 16:34:36 EST 2011
Author: tomjenkinson
Date: 2011-12-14 16:34:36 -0500 (Wed, 14 Dec 2011)
New Revision: 37802
Modified:
labs/jbosstm/branches/JBOSSTS_4_16/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
Log:
JBTM-895 updated to make the counter more usable based on its name
Modified: labs/jbosstm/branches/JBOSSTS_4_16/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java 2011-12-14 21:31:20 UTC (rev 37801)
+++ labs/jbosstm/branches/JBOSSTS_4_16/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java 2011-12-14 21:34:36 UTC (rev 37802)
@@ -137,7 +137,7 @@
assertTrue(completionCounter.getRollbackCount("2000") == 0);
assertTrue(completionCounter.getCommitCount("1000") == 0);
assertTrue(completionCounter.getRollbackCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
{
Thread thread = new Thread(new Runnable() {
public void run() {
@@ -165,19 +165,19 @@
} catch (ExecuteException e) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (LinkageError t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
}
@@ -213,19 +213,19 @@
} catch (ExecuteException e) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (LinkageError t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
}
@@ -234,7 +234,7 @@
thread.start();
}
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 2) {
+ if (phase2CommitAborted.getCount() < 2) {
phase2CommitAborted.wait();
}
}
@@ -243,10 +243,20 @@
reboot("2000");
reboot("3000");
+ final CompletionCountLock lock = new CompletionCountLock();
+
getLocalServer("2000").doRecoveryManagerScan(true);
+ lock.incrementCount();
getLocalServer("1000").doRecoveryManagerScan(true);
-
+ lock.incrementCount();
+
+ synchronized (lock) {
+ while (lock.getCount() < 2) {
+ lock.wait();
+ }
+ }
+
assertTrue(completionCounter.getCommitCount("1000") == 0);
assertTrue(completionCounter.getRollbackCount("1000") == 3);
assertTrue(completionCounter.getCommitCount("2000") == 0);
@@ -266,7 +276,7 @@
setup();
assertTrue(completionCounter.getCommitCount("2000") == 0);
assertTrue(completionCounter.getCommitCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
Thread thread = new Thread(new Runnable() {
public void run() {
int startingTimeout = 0;
@@ -296,7 +306,7 @@
} catch (Error t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
@@ -306,7 +316,7 @@
}, "Orphan-creator");
thread.start();
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 1) {
+ if (phase2CommitAborted.getCount() < 1) {
phase2CommitAborted.wait();
}
}
@@ -352,7 +362,7 @@
assertTrue(completionCounter.getCommitCount("3000") == 0);
assertTrue(completionCounter.getCommitCount("2000") == 0);
assertTrue(completionCounter.getCommitCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
Thread thread = new Thread(new Runnable() {
public void run() {
int startingTimeout = 0;
@@ -379,7 +389,7 @@
} catch (Error t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
@@ -393,7 +403,7 @@
}, "Orphan-creator");
thread.start();
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 1) {
+ if (phase2CommitAborted.getCount() < 1) {
phase2CommitAborted.wait();
}
}
@@ -438,7 +448,7 @@
assertTrue(completionCounter.getCommitCount("3000") == 0);
assertTrue(completionCounter.getCommitCount("2000") == 0);
assertTrue(completionCounter.getCommitCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
Thread thread = new Thread(new Runnable() {
public void run() {
int startingTimeout = 0;
@@ -465,19 +475,19 @@
} catch (ExecuteException e) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (LinkageError t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
}
@@ -485,7 +495,7 @@
}, "Orphan-creator");
thread.start();
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 1) {
+ if (phase2CommitAborted.getCount() < 1) {
phase2CommitAborted.wait();
}
}
@@ -527,7 +537,7 @@
assertTrue(completionCounter.getCommitCount("3000") == 0);
assertTrue(completionCounter.getCommitCount("2000") == 0);
assertTrue(completionCounter.getCommitCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
Thread thread = new Thread(new Runnable() {
public void run() {
int startingTimeout = 0;
@@ -554,19 +564,19 @@
} catch (ExecuteException e) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (LinkageError t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Throwable t) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
}
@@ -574,7 +584,7 @@
}, "Orphan-creator");
thread.start();
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 1) {
+ if (phase2CommitAborted.getCount() < 1) {
phase2CommitAborted.wait();
}
}
@@ -605,7 +615,7 @@
assertTrue(completionCounter.getRollbackCount("3000") == 0);
assertTrue(completionCounter.getRollbackCount("2000") == 0);
assertTrue(completionCounter.getRollbackCount("1000") == 0);
- final Phase2CommitAborted phase2CommitAborted = new Phase2CommitAborted();
+ final CompletionCountLock phase2CommitAborted = new CompletionCountLock();
Thread thread = new Thread(new Runnable() {
public void run() {
int startingTimeout = 0;
@@ -616,7 +626,7 @@
} catch (ExecuteException e) {
System.err.println("Should be a thread death but cest la vie");
synchronized (phase2CommitAborted) {
- phase2CommitAborted.incrementPhase2CommitAborted();
+ phase2CommitAborted.incrementCount();
phase2CommitAborted.notify();
}
} catch (Exception e) {
@@ -627,7 +637,7 @@
});
thread.start();
synchronized (phase2CommitAborted) {
- if (phase2CommitAborted.getPhase2CommitAbortedCount() < 1) {
+ if (phase2CommitAborted.getCount() < 1) {
phase2CommitAborted.wait();
}
}
@@ -1016,15 +1026,15 @@
return localServers[index];
}
- private class Phase2CommitAborted {
- private int phase2CommitAborted;
+ private class CompletionCountLock {
+ private int count;
- public int getPhase2CommitAbortedCount() {
- return phase2CommitAborted;
+ public int getCount() {
+ return count;
}
- public void incrementPhase2CommitAborted() {
- this.phase2CommitAborted++;
+ public void incrementCount() {
+ this.count++;
}
}
More information about the jboss-svn-commits
mailing list