Permalink
Browse files

Merge pull request #63 from ochaloup/BYTEMAN-345-dtest-instrument-ins…

…tance-concurrency-fail

[BYTEMAN-345] dtest instrument instance concurrency fail
  • Loading branch information...
2 parents 7261040 + f568f25 commit 95ed6b2694d1e919ea37db5d85036d5fc759d3f5 @ochaloup ochaloup committed on GitHub Jun 30, 2017
@@ -20,11 +20,10 @@
*/
package org.jboss.byteman.contrib.dtest;
-import java.util.ArrayList;
-import java.util.List;
-
import static org.junit.Assert.assertTrue;
+import java.util.Queue;
+
/**
* InstrumentedInstance instances serve two purposes:
*
@@ -40,7 +39,7 @@
{
private final String className;
private final Integer instanceId;
- private final List<String> methodTraces = new ArrayList<String>();
+ private final Queue<String> methodTraces = new java.util.concurrent.ConcurrentLinkedQueue<String>();
InstrumentedInstance(String className, Integer instanceId)
{
@@ -141,7 +141,20 @@ public void installHelperJar(String path) throws Exception
*/
public InstrumentedClass instrumentClass(Class clazz) throws Exception
{
- return instrumentClass(clazz, null);
+ Set<String> nullSet = null;
+ return instrumentClass(clazz, nullSet);
+ }
+
+ public InstrumentedClass instrumentClass(Class clazz, String... methodNames) throws Exception
+ {
+ if (methodNames ==null)
+ {
+ Set<String> nullSet = null;
+ return instrumentClass(clazz, nullSet);
+ } else
+ {
+ return instrumentClass(clazz, new HashSet<String>(Arrays.asList(methodNames)));
+ }
}
/**
@@ -170,6 +183,14 @@ public InstrumentedClass instrumentClass(Class clazz, Set<String> methodNames) t
}
/**
+ * See {@link #instrumentClass(String, Set)}
+ */
+ public InstrumentedClass instrumentClass(String className, String... methodNames) throws Exception
+ {
+ return instrumentClass(className, new HashSet<String>(Arrays.asList(methodNames)));
+ }
+
+ /**
* Add method tracing rules to the specified class name.<br>
* If a null set of method names is supplied, {@link NullPointerException} is thrown.
*

0 comments on commit 95ed6b2

Please sign in to comment.