Hi Scott,
Hmm, it's a while since I wrote that Wiki article. I think it may be
out-of-date.
If you want to control the position where ThreadWeaver stops the first
thread, I think you can do that by using the various methods in
InterleavedRunner. Take a look at InterleavedRunner.interleaveAfter(),
which I think will do what you want.
Let me know if that's not what you need.
Alasdair
Hi Scott,
My apologies for giving a slightly misleading answer earlier. I was
concentrating on your question about classloaders rather than about
the details of what you are trying to do.
Unfortunately, Threadweaver doesn't support static methods. This is
because breakpoints are specific to a given object, rather than just
to a method. So if I have:
class Foo {
public void Bar() {
}
}
Foo f;
Foo g;
Then a breakpoint that triggers when f.Bar() is called is not the same
as a breakpoint that triggers when g.Bar() is called.
The reason for doing this is partly a side-effect of the
implementation. For every instrumented object that gets created, we
create a new internal monitor that tracks what happens to that object.
(So when I invoke f.Bar(), I'm recording the method call in f's
monitor. Check out the internal comments in TestInstrumenter.java for
details.
Also, it seemed that having static methods is fairly uncommon in
multithreaded systems, apart from a few simple cases like factories
and so forth.
If you really do want to test a static method, then the best I can
suggest with the current Threadweaver code is to use a
non-instrumented breakpoint. Please see the last section of
http://code.google.com/p/thread-weaver/wiki/UsersGuide.
Hope this helps,
Alasdair
P.S. I can see from your test what you're trying to do. However, if
this is a general-purpose filing system, then I wonder how helpful the
test is going to be? Even if FSBolob can be shown to be threadsafe,
surely there's a risk that another thread (or another process) will
create the parent directory in the middle of a call to
makeParentDirs()?