aboutsummaryrefslogtreecommitdiff
path: root/src/After.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/After.java')
-rw-r--r--src/After.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/After.java b/src/After.java
index b36d5de..0ca78ca 100644
--- a/src/After.java
+++ b/src/After.java
@@ -7,6 +7,9 @@
* (c) CENA
*
* Changelog:
+ * 1.2.14
+ * - gracefully quits when message is received, by quitting the Ivy
+ * threads with bus.stop() , instead of invoking system.exit
* 1.2.8: new in the ivy package
*/
package fr.dgac.ivy.tools ;
@@ -29,9 +32,9 @@ public class After extends IvyApplicationAdapter implements IvyMessageListener {
case 'b': domain=opt.getOptarg(); break;
case 't': timeout=Integer.parseInt(opt.getOptarg()); break;
case 'h':
- default: System.out.println(helpmsg); System.exit(0);
+ default: System.out.println(helpmsg); return;
}
- if (opt.getOptind()!=args.length-1) { System.out.println(helpmsg); System.exit(0); }
+ if (opt.getOptind()!=args.length-1) { System.out.println(helpmsg); return; }
String regexp=args[opt.getOptind()];
Ivy bus=new Ivy(name,name+" ready",null);
bus.bindMsgOnce(regexp,new After(bus));
@@ -41,7 +44,6 @@ public class After extends IvyApplicationAdapter implements IvyMessageListener {
try { Thread.sleep(timeout*1000); } catch (InterruptedException ie) { }
System.out.println(regexp+" not received, bailing out");
bus.stop();
- System.exit(-1);
} else {
System.out.println("waiting forever for "+regexp);
}
@@ -56,12 +58,10 @@ public class After extends IvyApplicationAdapter implements IvyMessageListener {
public void die( IvyClient client, int id, String msgarg) {
System.out.println("die received, bailing out");
bus.stop();
- System.exit(-1);
}
public void receive(IvyClient ic,String[] args) {
bus.stop();
- System.exit(0);
}
}