All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.lang.Processors Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.lang;

import panda.lang.reflect.Fields;

public class Processors {
	public static long getPid(Process process) {
		try {
			return (Long)Fields.readField(process, "pid", true);
		}
		catch (Exception e) {
			return 0;
		}
	}
	
	public static class Waiter extends Thread {
		private int exitValue;
		private final Process process;

		public Waiter(Process process) {
			this.process = process;
		}

		public int exitValue() {
			return exitValue;
		}
		
		public void run() {
			try {
				exitValue = process.waitFor();
			}
			catch (InterruptedException ignore) {
				return;
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy