* access to it. It is set automatically during the build of the object.
*/
public long bind;
-
+ /**
+ * Indicates if the process is started
+ */
+ boolean started;
/**
* Even if this attribute is public you must never access to it.
* It is used to compute the id of an MSG process.
*/
public 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.
*/
public long id;
+
+ /**
+ * Start time of the process
+ */
+ public double startTime;
+ /**
+ * Kill time of the process
+ */
+ public double killTime;
public Hashtable<String,String> properties;
/** The arguments of the method function of the process. */
public Vector<String> args;
+
/**
* Default constructor (used in ApplicationHandler to initialize it)
*
*/
public Process(String hostname, String name) throws HostNotFoundException {
- this(Host.getByName(hostname), name, null);
+ this(Host.getByName(hostname), name, null, 0, -1);
}
/**
* Constructs a new process from the name of a host and his name. The arguments
*
*/
public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException {
- this(Host.getByName(hostname), name, args);
+ this(Host.getByName(hostname), name, args, 0, -1);
}
/**
* Constructs a new process from a host and his name. The method function of the
*
*/
public Process(Host host, String name) {
- this(host, name, null);
+ this(host, name, null, 0, -1);
}
/**
* Constructs a new process from a host and his name, the arguments of here method function are
* @param host The host of the process to create.
* @param name The name of the process.
* @param args The arguments of main method of the process.
+ * @param startTime Start time of the process
+ * @param killTime Kill time of the process
*
*/
- public Process(Host host, String name, String[]args) {
+ public Process(Host host, String name, String[]args, double startTime, double killTime) {
/* This is the constructor called by all others */
this();
this.host = host;
this.properties = new Hashtable<String,String>();
+ this.startTime = startTime;
+ this.killTime = killTime;
}
/**
* The natively implemented method to create an MSG process.
* @param host A valid (binded) host where create the process.
*/
- protected native void create(String hostName) throws HostNotFoundException;
+ protected native void create(String hostName, double startTime, double killTime) throws HostNotFoundException;
/**
* This method kills all running process of the simulation.
*
}
/**
* This method actually creates and run the process.
+ * It is a noop if the process is already launched.
* @throws HostNotFoundException
*/
- public void start() throws HostNotFoundException {
- create(host.getName());
+ public final void start() throws HostNotFoundException {
+ if (!started) {
+ started = true;
+ create(host.getName(), startTime, killTime);
+ }
}
/**
System.exit(1);
}
catch(ProcessKilledError pk) {
-
+
}
}