X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe0da55b4a4be0b7b074f24f32c44d3cbad9c1b4..8ab3de1117e168a8969922855a7a422546f49cf3:/org/simgrid/msg/Process.java?ds=sidebyside diff --git a/org/simgrid/msg/Process.java b/org/simgrid/msg/Process.java index 762dddb187..c4fca9598a 100644 --- a/org/simgrid/msg/Process.java +++ b/org/simgrid/msg/Process.java @@ -67,20 +67,33 @@ public abstract class Process extends Thread { */ public long id; - public Hashtable properties; + /** + * + */ + public Hashtable properties; /** * The name of the process. */ protected String name; - public String msgName() { + /** + * + * @return + */ + public String msgName() { return this.name; } /** The arguments of the method function of the process. */ public Vector args; /* process synchronization tools */ - protected Sem schedBegin, schedEnd; + /** + * + */ + /** + * + */ + protected Sem schedBegin, schedEnd; /** * Default constructor (used in ApplicationHandler to initialize it) @@ -120,7 +133,8 @@ public abstract class Process extends Thread { * @param args The arguments of the main function of the process. * * @exception HostNotFoundException if no host with this name exists. - * NativeException + * NativeException + * @throws NativeException * */ public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException { @@ -176,12 +190,23 @@ public abstract class Process extends Thread { return MsgNative.processKillAll(resetPID); } + + /** + * This method kill the current process. + * @param process the process to be killed. + * + */ + public static void kill(Process process) { + MsgNative.processKill(process); + } /** * This method adds an argument in the list of the arguments of the main function * of the process. * * @param arg The argument to add. - */ + * + * @deprecated + */ @Deprecated protected void addArg(String arg) { args.add(arg); @@ -218,7 +243,6 @@ public abstract class Process extends Thread { * * @return The host instance of the process. * - * @exception NativeException on error in the native SimGrid code * */ public Host getHost() { @@ -266,11 +290,12 @@ public abstract class Process extends Thread { /** * Migrates a process to another host. * + * @param process The process to migrate. * @param host The host where to migrate the process. * */ - public void migrate(Host host) { - MsgNative.processChangeHost(this, host); + public static void migrate(Process process, Host host) { + MsgNative.processMigrate(process, host); } /** * Makes the current process sleep until time seconds have elapsed. @@ -282,7 +307,10 @@ public abstract class Process extends Thread { public static void waitFor(double seconds) throws HostFailureException { MsgNative.processWaitFor(seconds); } - public void showArgs() { + /** + * + */ + public void showArgs() { Msg.info("[" + this.name + "/" + this.getHost().getName() + "] argc=" + this.args.size()); for (int i = 0; i < this.args.size(); i++) @@ -322,11 +350,17 @@ public abstract class Process extends Thread { /** * The main function of the process (to implement). - */ + * + * @param args + * @throws MsgException + */ public abstract void main(String[]args) throws MsgException; - public void unschedule() { + /** + * + */ + public void unschedule() { try { schedEnd.release(); schedBegin.acquire(); @@ -334,7 +368,10 @@ public abstract class Process extends Thread { } } - public void schedule() { + /** + * + */ + public void schedule() { //System.err.println("Scheduling process in Java"); try { schedBegin.release(); @@ -346,7 +383,10 @@ public abstract class Process extends Thread { } /** Send the given task in the mailbox associated with the specified alias (waiting at most given time) - * @throws TimeoutException + * @param mailbox + * @param task + * @param timeout + * @throws TimeoutException * @throws HostFailureException * @throws TransferFailureException */ public void taskSend(String mailbox, Task task, double timeout) throws TransferFailureException, HostFailureException, TimeoutException { @@ -354,29 +394,59 @@ public abstract class Process extends Thread { } /** Send the given task in the mailbox associated with the specified alias - * @throws TimeoutException + * @param mailbox + * @param task + * @throws TimeoutException * @throws HostFailureException * @throws TransferFailureException */ public void taskSend(String mailbox, Task task) throws TransferFailureException, HostFailureException, TimeoutException { MsgNative.taskSend(mailbox, task, -1); } - /** Receive a task on mailbox associated with the specified mailbox */ + /** Receive a task on mailbox associated with the specified mailbox + * @param mailbox + * @return + * @throws TransferFailureException + * @throws HostFailureException + * @throws TimeoutException + */ public Task taskReceive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException { return MsgNative.taskReceive(mailbox, -1.0, null); } - /** Receive a task on mailbox associated with the specified alias (waiting at most given time) */ + /** Receive a task on mailbox associated with the specified alias (waiting at most given time) + * @param mailbox + * @param timeout + * @return + * @throws TransferFailureException + * @throws HostFailureException + * @throws TimeoutException + */ public Task taskReceive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException { return MsgNative.taskReceive(mailbox, timeout, null); } - /** Receive a task on mailbox associated with the specified alias from given sender */ + /** Receive a task on mailbox associated with the specified alias from given sender + * @param mailbox + * @param host + * @param timeout + * @return + * @throws TransferFailureException + * @throws HostFailureException + * @throws TimeoutException + */ public Task taskReceive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException { return MsgNative.taskReceive(mailbox, timeout, host); } - /** Receive a task on mailbox associated with the specified alias from given sender*/ + /** Receive a task on mailbox associated with the specified alias from given sender + * @param mailbox + * @param host + * @return + * @throws TransferFailureException + * @throws HostFailureException + * @throws TimeoutException + */ public Task taskReceive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException { return MsgNative.taskReceive(mailbox, -1.0, host); }