diff options
author | jestin | 2004-07-27 16:23:00 +0000 |
---|---|---|
committer | jestin | 2004-07-27 16:23:00 +0000 |
commit | d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1 (patch) | |
tree | 7bea89fe499bf27ecc37c1c5b0d58e4639c26421 /tests/DieSender.java | |
parent | fd9c3e8ea4c7093bff92ec2162ca0be338024fa2 (diff) | |
download | ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.zip ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.gz ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.bz2 ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.xz |
major test rewrite to abide to the latest API. Updated tests for async msg
handling and protect newline
Diffstat (limited to 'tests/DieSender.java')
-rw-r--r-- | tests/DieSender.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/DieSender.java b/tests/DieSender.java new file mode 100644 index 0000000..c44446b --- /dev/null +++ b/tests/DieSender.java @@ -0,0 +1,43 @@ +/* + * sends die to the client specified by a string. + */ +import fr.dgac.ivy.* ; + +public class DieSender extends IvyApplicationAdapter { + + private String tokill; + private int targets = 0; + + public DieSender(Ivy bus,String mtokill) throws IvyException { + this.tokill=mtokill; + bus.addApplicationListener(this); + } + + /* + public void disconnect(IvyClient c) { + System.out.println(c.getApplicationName()); + if (c.getApplicationName().compareTo(tokill)==0) { + System.out.println(tokill+" left the bus"); + } + } + */ + + public void connect(IvyClient c) { + if (c.getApplicationName().compareTo(tokill)==0) { + System.out.println("found a "+tokill+" on the bus, sending Die Message"); + c.sendDie("meurs !"); + } + } + + public static final String DEFAULTTOKILL = "JPROBE" ; + + public static void main(String[] args) throws IvyException { + String mtokill = DEFAULTTOKILL; + String domain = Ivy.getDomain(null); + System.out.println("will kill each and every " + mtokill + " on the " + domain +" bus"); + Ivy bus = new Ivy("DieSender","DieSender ready",null); + bus.start(Ivy.getDomain(null)); + new DieSender(bus,mtokill); + } + +} |