processing.app.exec.ProcessRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pde Show documentation
Show all versions of pde Show documentation
Processing is a programming language, development environment, and online community.
This PDE package contains the Processing IDE.
package processing.app.exec;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class ProcessRegistry {
private static final Set REGISTRY = Collections
.synchronizedSet(new HashSet());
static {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
synchronized (REGISTRY) {
for (final Process p : REGISTRY) {
try {
// System.err.println("Cleaning up rogue process " + p);
p.destroy();
} catch (final Exception drop) {
}
}
}
}
});
}
/**
* When starting up a process
* @param p
*/
public static void watch(final Process p) {
REGISTRY.add(p);
}
public static void unwatch(final Process p) {
REGISTRY.remove(p);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy