# HG changeset patch # User dcubed # Date 1206394307 25200 # Node ID db5c79396919e16f23416abee0abe869a27454aa # Parent aa06754a95de26327a219fa010b27145f5875386 6239043: 4/4 TransformerManagementThreadAddTests.java failed Summary: Clear fCheckedTransformers in order to properly record transformer() call data. Reviewed-by: sspitsyn diff -r aa06754a95de -r db5c79396919 jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java --- a/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java Fri Mar 21 18:07:57 2008 +0100 +++ b/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java Mon Mar 24 14:31:47 2008 -0700 @@ -79,6 +79,12 @@ protected static final int TOTAL_THREADS = MAX_TRANS - MIN_TRANS + 1; private byte[] fDummyClassBytes; + // fCheckedTransformers is a Vector that is used to verify + // that the transform() function is called in the same + // order in which the transformers were added to the + // TransformerManager. The test currently verifies that all + // transformers for a specific worker thread are in + // increasing order by index value. private Vector fCheckedTransformers; private Instrumentation fInstrumentation; private int fFinished; @@ -264,11 +270,19 @@ private void executeTransform() { - fCheckedTransformers.clear(); - try { ClassDefinition cd = new ClassDefinition(DummyClass.class, fDummyClassBytes); + + // When the ClassDefinition above is created for the first + // time and every time redefineClasses() below is called, + // the transform() function is called for each registered + // transformer. We only want one complete set of calls to + // be logged in the fCheckedTransformers Vector so we clear + // any calls logged for ClassDefinition above and just use + // the ones logged for redefineClasses() below. + fCheckedTransformers.clear(); + getInstrumentation().redefineClasses(new ClassDefinition[]{ cd }); } catch (ClassNotFoundException e)