From ff4cb50da99dff92aba52db9c9a34bc6aee08788 Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 17 Mar 2010 11:22:47 +0000 Subject: [PATCH] fix the examples now that they can throw potentially more exception types git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7264 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/java/basic/Forwarder.java | 2 +- examples/java/basic/Master.java | 2 +- examples/java/comm_time/Master.java | 2 +- examples/java/ping_pong/Sender.java | 2 +- src/java/simgrid/msg/Process.java | 16 +++++++++++----- src/java/simgrid/msg/Task.java | 10 ++++++++-- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/examples/java/basic/Forwarder.java b/examples/java/basic/Forwarder.java index 46d1186d57..741133f7c9 100644 --- a/examples/java/basic/Forwarder.java +++ b/examples/java/basic/Forwarder.java @@ -9,7 +9,7 @@ import simgrid.msg.*; public class Forwarder extends simgrid.msg.Process { - public void main(String[] args) throws NativeException { + public void main(String[] args) throws MsgException { if (args.length < 3) { Msg.info("Forwarder needs 3 arguments (input mailbox, first output mailbox, last one)"); Msg.info("Got "+args.length+" instead"); diff --git a/examples/java/basic/Master.java b/examples/java/basic/Master.java index 90e55dca73..eab3bf5f95 100644 --- a/examples/java/basic/Master.java +++ b/examples/java/basic/Master.java @@ -10,7 +10,7 @@ import simgrid.msg.*; public class Master extends simgrid.msg.Process { - public void main(String[] args) throws NativeException { + public void main(String[] args) throws MsgException { if (args.length < 4) { Msg.info("Master needs 4 arguments"); System.exit(1); diff --git a/examples/java/comm_time/Master.java b/examples/java/comm_time/Master.java index 38ca35b522..c2bbc5ce8b 100644 --- a/examples/java/comm_time/Master.java +++ b/examples/java/comm_time/Master.java @@ -10,7 +10,7 @@ import simgrid.msg.*; public class Master extends simgrid.msg.Process { - public void main(String[] args) throws NativeException { + public void main(String[] args) throws MsgException { if (args.length < 4) { Msg.info("Master needs 4 arguments"); System.exit(1); diff --git a/examples/java/ping_pong/Sender.java b/examples/java/ping_pong/Sender.java index eca3688fa1..17f2dfd267 100644 --- a/examples/java/ping_pong/Sender.java +++ b/examples/java/ping_pong/Sender.java @@ -14,7 +14,7 @@ public class Sender extends simgrid.msg.Process { private final double commSizeLat = 1; final double commSizeBw = 100000000; - public void main(String[] args) throws NativeException { + public void main(String[] args) throws MsgException { Msg.info("hello!"); diff --git a/src/java/simgrid/msg/Process.java b/src/java/simgrid/msg/Process.java index 5a0fafc52a..f1e8049684 100644 --- a/src/java/simgrid/msg/Process.java +++ b/src/java/simgrid/msg/Process.java @@ -334,7 +334,7 @@ public abstract class Process extends Thread { /** * The main function of the process (to implement). */ - public abstract void main(String[]args) throws NativeException; + public abstract void main(String[]args) throws MsgException; public void unschedule() { @@ -353,13 +353,19 @@ public abstract class Process extends Thread { } } - /** Send the given task in the mailbox associated with the specified alias (waiting at most given time) */ - public void taskSend(String mailbox, Task task, double timeout) throws NativeException { + /** Send the given task in the mailbox associated with the specified alias (waiting at most given time) + * @throws TimeoutException + * @throws HostFailureException + * @throws TransferFailureException */ + public void taskSend(String mailbox, Task task, double timeout) throws NativeException, TransferFailureException, HostFailureException, TimeoutException { MsgNative.taskSend(mailbox, task, timeout); } - /** Send the given task in the mailbox associated with the specified alias*/ - public void taskSend(String mailbox, Task task) throws NativeException { + /** Send the given task in the mailbox associated with the specified alias + * @throws TimeoutException + * @throws HostFailureException + * @throws TransferFailureException */ + public void taskSend(String mailbox, Task task) throws NativeException, TransferFailureException, HostFailureException, TimeoutException { MsgNative.taskSend(mailbox, task, -1); } diff --git a/src/java/simgrid/msg/Task.java b/src/java/simgrid/msg/Task.java index 52f48b4bc2..3c54be47a0 100644 --- a/src/java/simgrid/msg/Task.java +++ b/src/java/simgrid/msg/Task.java @@ -132,8 +132,11 @@ public class Task { * Sends the task on the mailbox identified by the specified name * * @exception NativeException if the retrieval fails. + * @throws TimeoutException + * @throws HostFailureException + * @throws TransferFailureException */ - public void send(String mailbox) throws NativeException { + public void send(String mailbox) throws NativeException, TransferFailureException, HostFailureException, TimeoutException { MsgNative.taskSend(mailbox, this, -1); } @@ -141,8 +144,11 @@ public class Task { * Sends the task on the mailbox identified by the specified name (wait at most \a timeout seconds) * * @exception NativeException if the retrieval fails. + * @throws TimeoutException + * @throws HostFailureException + * @throws TransferFailureException */ - public void send(String mailbox, double timeout) throws NativeException { + public void send(String mailbox, double timeout) throws NativeException, TransferFailureException, HostFailureException, TimeoutException { MsgNative.taskSend(mailbox, this, timeout); } -- 2.20.1