[jboss-svn-commits] JBL Code SVN: r37668 - in labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests: classes/com/arjuna/ats/jta/distributed and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 25 07:06:17 EDT 2011


Author: tomjenkinson
Date: 2011-10-25 07:06:17 -0400 (Tue, 25 Oct 2011)
New Revision: 37668

Modified:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/byteman-scripts/leaveorphan.txt
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java
Log:
JBTM-895 made the byteman rule clearer as byteman handles Thread.stop by throwing a runtimeexception, unfortanately/fortunately TS is able to handle unexpected runtimes thrown by XAResources so it is not enough to just throw a runtime, I therefore throw an Error which TS doesn't handle, but to work around a restriction of byteman I needed to declare that TestResource can throw an Error out of prepare

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/byteman-scripts/leaveorphan.txt
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/byteman-scripts/leaveorphan.txt	2011-10-25 07:58:10 UTC (rev 37667)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/byteman-scripts/leaveorphan.txt	2011-10-25 11:06:17 UTC (rev 37668)
@@ -12,62 +12,5 @@
 BIND NOTHING
 IF TRUE
 	DO debug("Neutralizing target"),
-	Thread.currentThread().stop()
-ENDRULE
-
-
-#########################################################################
-RULE Fail phase2abort ;)
-CLASS  com.arjuna.ats.arjuna.coordinator.BasicAction
-METHOD prepare
-AT EXIT
-BIND NOTHING
-IF TRUE
-	DO debug("Target neutralized"), 
-	Thread.currentThread().stop()
-ENDRULE
-
-#########################################################################
-RULE Fail insertRecord
-CLASS  com.arjuna.ats.arjuna.coordinator.BasicAction
-METHOD insertRecord
-AT ENTRY
-BIND NOTHING
-IF TRUE
-	DO debug("Target neutralized"), 
-	Thread.currentThread().stop()
-ENDRULE
-
-#########################################################################
-RULE Fail topLevelPrepare
-CLASS  com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord
-METHOD topLevelPrepare
-AT EXIT
-BIND NOTHING
-IF TRUE
-	DO debug("Target neutralized"), 
-	Thread.currentThread().stop()
-ENDRULE
-
-#########################################################################
-RULE Fail topLevelPrepare
-CLASS  com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord
-METHOD topLevelOnePhaseCommit
-AT EXIT
-BIND NOTHING
-IF TRUE
-	DO debug("Target neutralized"), 
-	Thread.currentThread().stop()
-ENDRULE
-
-#########################################################################
-RULE Fail phase2Commit - die die die
-CLASS  com.arjuna.ats.arjuna.coordinator.BasicAction
-METHOD phase2Commit
-AT ENTRY
-BIND NOTHING
-IF TRUE
-	DO debug("Assassinated"),
-	incrementCounter("phase2commit");
-   	Thread.currentThread().stop()
+	throw new java.lang.Error()
 ENDRULE
\ No newline at end of file

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-25 07:58:10 UTC (rev 37667)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-25 11:06:17 UTC (rev 37668)
@@ -279,18 +279,12 @@
 					originalServer.removeRootTransaction(currentXid);
 					transactionManager.commit();
 					Thread.currentThread().setContextClassLoader(classLoader);
-				} catch (ExecuteException e) {
+				} catch (Error t) {
 					System.err.println("Should be a thread death but cest la vie");
 					synchronized (phase2CommitAborted) {
 						phase2CommitAborted.incrementPhase2CommitAborted();
 						phase2CommitAborted.notify();
 					}
-				} catch (LinkageError t) {
-					System.err.println("Should be a thread death but cest la vie");
-					synchronized (phase2CommitAborted) {
-						phase2CommitAborted.incrementPhase2CommitAborted();
-						phase2CommitAborted.notify();
-					}
 				} catch (Throwable t) {
 					t.printStackTrace();
 				}
@@ -357,24 +351,18 @@
 					originalServer.removeRootTransaction(currentXid);
 					transactionManager.commit();
 					Thread.currentThread().setContextClassLoader(classLoader);
-				} catch (ExecuteException e) {
+				} catch (Error t) {
 					System.err.println("Should be a thread death but cest la vie");
 					synchronized (phase2CommitAborted) {
 						phase2CommitAborted.incrementPhase2CommitAborted();
 						phase2CommitAborted.notify();
 					}
-				} catch (LinkageError t) {
-					System.err.println("Should be a thread death but cest la vie");
-					synchronized (phase2CommitAborted) {
-						phase2CommitAborted.incrementPhase2CommitAborted();
-						phase2CommitAborted.notify();
-					}
 				} catch (Throwable t) {
-					System.err.println("Should be a thread death but cest la vie");
-					synchronized (phase2CommitAborted) {
-						phase2CommitAborted.incrementPhase2CommitAborted();
-						phase2CommitAborted.notify();
-					}
+					t.printStackTrace();
+//					synchronized (phase2CommitAborted) {
+//						phase2CommitAborted.incrementPhase2CommitAborted();
+//						phase2CommitAborted.notify();
+//					}
 				}
 			}
 		}, "Orphan-creator");

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java	2011-10-25 07:58:10 UTC (rev 37667)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java	2011-10-25 11:06:17 UTC (rev 37668)
@@ -86,7 +86,11 @@
 		};
 	}
 
-	public synchronized int prepare(Xid xid) throws XAException {
+	/**
+	 * This class declares that it throws an Error *purely for byteman* so that we can crash the resource during this method:
+	 * https://issues.jboss.org/browse/BYTEMAN-156
+	 */
+	public synchronized int prepare(Xid xid) throws XAException, Error {
 		System.out.println("        TestResource (" + serverId + ")      XA_PREPARE [" + xid + "]");
 
 		if (readonly)



More information about the jboss-svn-commits mailing list