- Msg.processCreate(this,host);
- }
-
- /**
- * This method kills all running process of the simulation.
- *
- * @param resetPID Should we reset the PID numbers. A negative number means no reset
- * and a positive number will be used to set the PID of the next newly
- * created process.
- *
- * @return The function returns the PID of the next created process.
- *
- */
- public static int killAll(int resetPID){
- return Msg.processKillAll(resetPID);
- }
-
- /**
- * This method adds an argument in the list of the arguments of the main function
- * of the process.
- *
- * @param arg The argument to add.
- */
- protected void addArg(String arg) {
- args.add(arg);
- }
-
- /**
- * This method suspends the process by suspending the task on which it was
- * waiting for the completion.
- *
- * @exception JniException on JNI madness
- * NativeException on error in the native SimGrid code
- */
- public void pause() throws JniException,NativeException {
- Msg.processSuspend(this);
- }
-
- /**
- * This method resumes a suspended process by resuming the task on which it was
- * waiting for the completion.
- *
- * @exception JniException on JNI madness
- * NativeException on error in the native SimGrid code
- *
- */
- public void restart() throws JniException,NativeException {
- Msg.processResume(this);
- }
-
- /**
- * This method tests if a process is suspended.
- *
- * @return The method returns true if the process is suspended.
- * Otherwise the method returns false.
- *
- * @exception JniException on JNI madness
- */
- public boolean isSuspended() throws JniException {
- return Msg.processIsSuspended(this);
- }
-
- /**
- * This method returns the host of a process.
- *
- * @return The host instance of the process.
- *
- * @exception JniException on JNI madness
- * NativeException on error in the native SimGrid code
- *
- */
- public Host getHost() throws JniException,NativeException{
- return Msg.processGetHost(this);
- }
-
- /**
- * This static method get a process from a PID.
- *
- * @param PID The process identifier of the process to get.
- *
- * @return The process with the specified PID.
- *
- * @exception NativeException on error in the native SimGrid code
- */
- public static Process fromPID(int PID) throws NativeException {
- return Msg.processFromPID(PID);
- }
-
- /**
- * This method returns the PID of the process.
- *
- * @return The PID of the process.
- *
- * @exception JniException on JNI madness
- * NativeException on error in the native SimGrid code
- */
- public int getPID() throws JniException,NativeException{
- return Msg.processGetPID(this);
- }
-
- /**
- * This method returns the PID of the parent of a process.
- *
- * @return The PID of the parent of the process.
- *
- * @exception NativeException on error in the native SimGrid code
- */
- public int getPPID() throws NativeException{
- return Msg.processGetPPID(this);
- }
-
- /**
- * This static method returns the currently running process.
- *
- * @return The current process.
- *
- * @exception NativeException on error in the native SimGrid code
- *
- *
- */
- public static Process currentProcess() throws NativeException{
- return Msg.processSelf();
- }
-
- /**
- * This static method returns the PID of the currently running process.
- *
- * @return The PID of the current process.
- */
- public static int currentProcessPID(){
- return Msg.processSelfPID();
- }
-
- /**
- * This static method returns the PID of the parent of the currently running process.
- *
- * @return The PID of the parent of current process.
- */
- public static int currentProcessPPID(){
- return Msg.processSelfPPID();
- }
-
- /**
- * This function migrates a process to another host.
- *
- * @parm host The host where to migrate the process.
- *
- * @exception JniException on JNI madness
- * NativeException on error in the native SimGrid code
- */
- public void migrate(Host host) throws JniException, NativeException{
- Msg.processChangeHost(this,host);
- }
-
- /**
- * This method makes the current process sleep until time seconds have elapsed.
- *
- * @param seconds The time the current process must sleep.
- *
- * @exception NativeException on error in the native SimGrid code
- */
- public static void waitFor(double seconds) throws NativeException {
- Msg.processWaitFor(seconds);
- }
-
-
- public void showArgs(){
- try {
- Msg.info("["+this.name+"/"+this.getHost().getName()+"] argc="+this.args.size() );
- for(int i = 0; i < this.args.size(); i++)
- Msg.info("["+this.msgName()+"/"+this.getHost().getName()+
- "] args["+i+"]="+(String)(this.args.get(i)));
- } catch (MsgException e) {
- Msg.info("Damn JNI stuff");
- e.printStackTrace();
- System.exit(1);
+ if (name == null)
+ throw new NullPointerException("Process name cannot be NULL");
+ this.name = name;
+
+ this.args = new Vector<String>();
+ if (null != args)
+ this.args.addAll(Arrays.asList(args));
+
+ MsgNative.processCreate(this, host);
+ }
+
+
+ /**
+ * This method kills all running process of the simulation.
+ *
+ * @param resetPID Should we reset the PID numbers. A negative number means no reset
+ * and a positive number will be used to set the PID of the next newly
+ * created process.
+ *
+ * @return The function returns the PID of the next created process.
+ *
+ */
+ public static int killAll(int resetPID) {
+ return MsgNative.processKillAll(resetPID);
+ }
+
+ /**
+ * 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
+ protected void addArg(String arg) {
+ args.add(arg);
+ }
+
+ /**
+ * Suspends the process by suspending the task on which it was
+ * waiting for the completion.
+ *
+ * @exception NativeException on error in the native SimGrid code
+ */
+ public void pause() throws NativeException {
+ MsgNative.processSuspend(this);
+ }
+ /**
+ * Resumes a suspended process by resuming the task on which it was
+ * waiting for the completion.
+ *
+ * @exception NativeException on error in the native SimGrid code
+ *
+ */
+ public void restart() throws NativeException {
+ MsgNative.processResume(this);
+ }
+ /**
+ * Tests if a process is suspended.
+ *
+ * @return The method returns true if the process is suspended.
+ * Otherwise the method returns false.
+ */
+ public boolean isSuspended() {
+ return MsgNative.processIsSuspended(this);
+ }
+ /**
+ * Returns the host of a process.
+ *
+ * @return The host instance of the process.
+ *
+ * @exception NativeException on error in the native SimGrid code
+ *
+ */
+ public Host getHost() throws NativeException {
+ return MsgNative.processGetHost(this);