RaceTestApplet
is based on
RaceTest
,
but it extends Applet and uses
SelfishRunnerTextArea
instead of
SelfishRunner
.
SelfishRunnerTextArea
merely writes to a TextArea
widget as well as stdout.
The really interesting thing here is that on certain platforms the output is different depending on whether RaceTestApplet was run as an applet or an application. For example under Solaris2.5.1 with JDK1.1.4 and green threads, we get:
cxh@carson 123% java -green RaceTestApplet Selfish: Thread #0, tick = 50000 Selfish: Thread #0, tick = 100000 Selfish: Thread #0, tick = 150000 Selfish: Thread #0, tick = 200000 Selfish: Thread #0, tick = 250000 Selfish: Thread #0, tick = 300000 Selfish: Thread #0, tick = 350000 Selfish: Thread #0, tick = 400000 Selfish: Thread #1, tick = 50000 Selfish: Thread #1, tick = 100000 Selfish: Thread #1, tick = 150000 Selfish: Thread #1, tick = 200000 Selfish: Thread #1, tick = 250000 Selfish: Thread #1, tick = 300000 Selfish: Thread #1, tick = 350000 Selfish: Thread #1, tick = 400000 cxh@carson 124%I believe that the reason for this is that the applet has multiple threads running.