* The name of the process.
*/
protected String name;
+ /**
+ * The PID of the process
+ */
+ protected int pid = -1;
+ /**
+ * The PPID of the process
+ */
+ protected int ppid = -1;
+ /**
+ * The host of the process
+ */
+ protected Host host = null;
/**
*
* @return
this.args.addAll(Arrays.asList(args));
MsgNative.processCreate(this, host);
+
}
*/
public Host getHost() {
Process.ifInterruptedStop();
- return MsgNative.processGetHost(this);
+ if (this.host == null) {
+ this.host = MsgNative.processGetHost(this);
+ }
+ return this.host;
}
/**
* This static method gets a process from a PID.
*/
public int getPID() {
Process.ifInterruptedStop();
- return MsgNative.processGetPID(this);
+ if (pid == -1) {
+ pid = MsgNative.processGetPID(this);
+ }
+ return pid;
}
/**
* This method returns the PID of the parent of a process.
*/
public int getPPID() {
Process.ifInterruptedStop();
- return MsgNative.processGetPPID(this);
+ if (ppid == -1) {
+ ppid = MsgNative.processGetPPID(this);
+ }
+ return ppid;
}
/**
* This static method returns the currently running process.
public static void migrate(Process process, Host host) {
Process.ifInterruptedStop();
MsgNative.processMigrate(process, host);
+ process.host = null;
}
/**
* Makes the current process sleep until time seconds have elapsed.