Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'master' and 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / bindings / java / org / simgrid / msg / Process.java
index f26fda4..355856d 100644 (file)
@@ -48,26 +48,11 @@ public abstract class Process implements Runnable {
         */
        private long bind = 0;
        /** Indicates if the process is started */
-       /**
-        * Even if this attribute is public you must never access to it.
-        * It is used to compute the id of an MSG process.
-        */
-       private static long nextProcessId = 0;
-
-       /**
-        * Even if this attribute is public you must never access to it.
-        * It is compute automatically during the creation of the object. 
-        * The native functions use this identifier to synchronize the process.
-        */
-       private long id;
 
        /** Time at which the process should be created  */
        protected double startTime = 0;
-       /** Time at which the process should be killed.
-        * 
-        * Set at creation, and used internally by SimGrid
-        */
-       private double killTime = -1;
+       /** Time at which the process should be killed */
+       private double killTime = -1; // Used from the C world
 
        private String name = null;
        
@@ -128,11 +113,10 @@ public abstract class Process implements Runnable {
        public Process(Host host, String name, String[]args) 
        {
                if (host == null)
-                       throw new NullPointerException("Cannot create a process on the null host");
+                       throw new IllegalArgumentException("Cannot create a process on the null host");
                if (name == null)
-                       throw new NullPointerException("Process name cannot be null");
+                       throw new IllegalArgumentException("Process name cannot be null");
                
-               this.id = nextProcessId++;
                this.host = host;
                this.name = name;
 
@@ -157,10 +141,11 @@ public abstract class Process implements Runnable {
                this.killTime = killTime;
        }
        /**
-        * The natively implemented method to create an MSG process.
-        * @param hostName    A valid (bound) host where create the process.
+        * The native method to create an MSG process.
+        * @param host    where to create the process.
         */
-       protected native void create(String hostName) throws HostNotFoundException;
+       protected native void create(Host host);
+       
        /**
         * This method kills all running process of the simulation.
         *
@@ -299,8 +284,8 @@ public abstract class Process implements Runnable {
         * @throws HostNotFoundException
         */
        public final void start() throws HostNotFoundException {
-               if (bind != 0)
-                       create(host.getName());
+               if (bind == 0)
+                        create(host);
        }
 
        /** This method runs the process. It calls the method function that you must overwrite. */