Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ensures that the native libraries are always loaded before trying to access them
[simgrid.git] / org / simgrid / msg / Process.java
index 714a7a3..edde2bf 100644 (file)
@@ -1,21 +1,16 @@
 /*
- * $Id$
- *
- * Copyright 2006,2007 Martin Quinson, Malek Cherier           
+ * Copyright 2006-2012 The SimGrid team
  * All right 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. 
+ * (GNU LGPL) which comes with this package.
  */
 
 package org.simgrid.msg;
  
 import java.util.Arrays;
-import java.util.Hashtable;
 import java.util.Vector;
-import java.lang.Runnable;
-import java.util.concurrent.Semaphore;
 
 /**
  * A process may be defined as a code, with some private data, executing 
@@ -54,7 +49,7 @@ public abstract class Process implements Runnable {
         * a native process. Even if this attribute is public you must never
         * access to it. It is set automatically during the build of the object.
         */
-       public long bind;
+       private long bind;
        /**
         * Indicates if the process is started
         */
@@ -80,9 +75,7 @@ public abstract class Process implements Runnable {
         * Kill time of the process
         */
        public double killTime = -1;
-
-    public Hashtable<String,String> properties;
-
+       
        /**
         * The name of the process.                                                     
         */
@@ -112,7 +105,6 @@ public abstract class Process implements Runnable {
                this.name = null;
                this.bind = 0;
                this.args = new Vector<String>();
-               this.properties = null;
        }
 
 
@@ -175,8 +167,6 @@ public abstract class Process implements Runnable {
                this.args = new Vector<String>();
                if (null != args)
                        this.args.addAll(Arrays.asList(args));
-               
-               this.properties = new Hashtable<String,String>();
        }       
        /**
         * Constructs a new process from a host and his name, the arguments of here method function are
@@ -199,9 +189,7 @@ public abstract class Process implements Runnable {
                this.args = new Vector<String>();
                if (null != args)
                        this.args.addAll(Arrays.asList(args));
-               
-               this.properties = new Hashtable<String,String>();
-               
+                               
                this.startTime = startTime;
                this.killTime = killTime;               
        }
@@ -242,14 +230,13 @@ public abstract class Process implements Runnable {
                suspend();
        }
        /**
-        * Resumes a suspended process by resuming the task on which it was
-        * waiting for the completion.
-        * DEPRECATED: use resume instead.
-        */ 
-       @Deprecated
-       public void restart() {
-               resume();
-       }
+        * Sets the "auto-restart" flag of the process.
+        */
+       public native void setAutoRestart(boolean autoRestart);
+       /**
+        * Restarts the process from the beginning
+        */
+       public native void restart();
        /**
         * Resumes a suspended process by resuming the task on which it was
         * waiting for the completion.
@@ -303,6 +290,11 @@ public abstract class Process implements Runnable {
        public int getPPID()  {
                return ppid;
        }
+       /**
+        * @brief Returns the value of a given process property. 
+        */
+       public native String getProperty(String name);
+       
        /**
         * Set the kill time of the process
         * @param killTime the time when the process is killed
@@ -409,6 +401,14 @@ public abstract class Process implements Runnable {
         */
        public static native void nativeInit();
        static {
+               Msg.nativeInit();
                nativeInit();
        }
+       /**
+        * This static method returns the current amount of processes running
+        *
+        * @return                      The count of the running processes
+        */ 
+       public native static int getCount();
+
 }