Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill trailing whitespaces in source code files.
[simgrid.git] / src / bindings / java / org / simgrid / msg / Process.java
index 894032c..c5cdfc1 100644 (file)
@@ -1,16 +1,12 @@
-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package org.simgrid.msg;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.List;
 
 /**
  * A process may be defined as a code, with some private data, executing
@@ -18,12 +14,12 @@ import java.util.List;
  * declared in the deployment file (XML format).
  * To create your own process you must inherit your own process from this
  * class and override the method "main()". For example if you want to use
- * a process named Slave proceed as it :
+ * a process named Worker proceed as it :
  *
  * (1) import the class Process of the package simgrid.msg
  * import simgrid.msg.Process;
  *
- * public class Slave extends simgrid.msg.Process {
+ * public class Worker extends simgrid.msg.Process {
  *
  *  (2) Override the method function
  *
@@ -34,9 +30,9 @@ import java.util.List;
  *  \endverbatim
  * }
  * The name of your process must be declared in the deployment file of your simulation.
- * For the example, for the previous process Slave this file must contains a line :
- * <process host="Maxims" function="Slave"/>, where Maxims is the host of the process
- * Slave. All the process of your simulation are automatically launched and managed by Msg.
+ * For the example, for the previous process Worker this file must contains a line :
+ * <process host="Maxims" function="Worker"/>, where Maxims is the host of the process
+ * Worker. All the process of your simulation are automatically launched and managed by Msg.
  * A process use tasks to simulate communications or computations with another process.
  * For more information see Task. For more information on host concept
  * see Host.
@@ -58,7 +54,7 @@ public abstract class Process implements Runnable {
        private double killTime = -1; // Used from the C world
 
        private String name = null;
-       
+
        private int pid = -1;
        private int ppid = -1;
        private Host host = null;
@@ -77,7 +73,7 @@ public abstract class Process implements Runnable {
         *
         *
         */
-       public Process(String hostname, String name) throws HostNotFoundException {
+       protected Process(String hostname, String name) throws HostNotFoundException {
                this(Host.getByName(hostname), name, null);
        }
        /**
@@ -91,7 +87,7 @@ public abstract class Process implements Runnable {
         * @exception                   HostNotFoundException  if no host with this name exists.
         *
         */
-       public Process(String hostname, String name, String[] args) throws HostNotFoundException {
+       protected Process(String hostname, String name, String[] args) throws HostNotFoundException {
                this(Host.getByName(hostname), name, args);
        }
        /**
@@ -102,7 +98,7 @@ public abstract class Process implements Runnable {
         * @param name                  The name of the process.
         *
         */
-       public Process(Host host, String name) {
+       protected Process(Host host, String name) {
                this(host, name, null);
        }
        /**
@@ -112,14 +108,14 @@ public abstract class Process implements Runnable {
         * @param host                  Where to create the process.
         * @param name                  The name of the process.
         * @param argsParam             The arguments of main method of the process.
-        */     
-       public Process(Host host, String name, String[]argsParam)
+        */
+       protected Process(Host host, String name, String[]argsParam)
        {
                if (host == null)
                        throw new IllegalArgumentException("Cannot create a process on the null host");
                if (name == null)
                        throw new IllegalArgumentException("Process name cannot be null");
-               
+
                this.host = host;
                this.name = name;
 
@@ -138,7 +134,7 @@ public abstract class Process implements Runnable {
         * @param killTime              Kill time of the process
         *
         */
-       public Process(Host host, String name, String[]args, double startTime, double killTime) {
+       protected Process(Host host, String name, String[]args, double startTime, double killTime) {
                this(host, name, args);
                this.startTime = startTime;
                this.killTime = killTime;
@@ -148,7 +144,7 @@ public abstract class Process implements Runnable {
         * @param host    where to create the process.
         */
        protected native void create(Host host);
-       
+
        /**
         * This method kills all running process of the simulation.
         */
@@ -162,21 +158,21 @@ public abstract class Process implements Runnable {
        public static void kill(Process p) {
                p.kill();
        }
-       
+
        /** Suspends the process. See {@link #resume()} to resume it afterward */
        public native void suspend();
        /** Resume a process that was suspended by {@link #suspend()}. */
-       public native void resume();    
+       public native void resume();
        /** Tests if a process is suspended.
         *
-        * @see #suspend()
-        * @see #resume()
+        * @see suspend()
+        * @see resume()
         */
        public native boolean isSuspended();
-       
+
        /** Yield the current process. All other processes that are ready at the same timestamp will be executed first */
        public static native void yield();
-       
+
        /**
         * Specify whether the process should restart when its host restarts after a failure
         *
@@ -254,11 +250,11 @@ public abstract class Process implements Runnable {
         * @param host                  The host where to migrate the process.
         *
         */
-       public native void migrate(Host host);  
+       public native void migrate(Host host);
        /**
         * Makes the current process sleep until millis milliseconds have elapsed.
-        * You should note that unlike "waitFor" which takes seconds, this method takes milliseconds.
-        * FIXME: Not optimal, maybe we should have two native functions.
+        * You should note that unlike "waitFor" which takes seconds (as usual in SimGrid), this method takes milliseconds (as usual for sleep() in Java).
+        *
         * @param millis the length of time to sleep in milliseconds.
         */
        public static void sleep(long millis) throws HostFailureException  {