forked from bytemanproject/byteman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for BYTEMAN-205 c/o James Livingstone's patch -- slightly modified
- Loading branch information
Showing
5 changed files
with
369 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
agent/src/test/java/org/jboss/byteman/tests/helpers/TestThread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.jboss.byteman.tests.helpers; | ||
|
||
import java.util.concurrent.BrokenBarrierException; | ||
import java.util.concurrent.CyclicBarrier; | ||
|
||
import org.jboss.byteman.tests.helpertests.TestStackTrace; | ||
|
||
|
||
public class TestThread extends Thread { | ||
private static CyclicBarrier barrier = new CyclicBarrier(2); | ||
|
||
private final boolean trigger; | ||
private final TestStackTrace inner; | ||
|
||
public TestThread(TestStackTrace inner, boolean trigger) { | ||
super("TestThread-" + trigger); | ||
this.trigger = trigger; | ||
this.inner = inner; | ||
} | ||
|
||
public void run() { | ||
sync(); | ||
if (trigger) | ||
fire(); | ||
sync(); | ||
} | ||
|
||
private void sync() { | ||
try { | ||
barrier.await(); | ||
} catch (InterruptedException ex) { | ||
return; | ||
} catch (BrokenBarrierException ex) { | ||
return; | ||
} | ||
} | ||
|
||
private void fire() { | ||
} | ||
} |
Oops, something went wrong.