本文整理汇总了Java中org.jvnet.winp.WinProcess类的典型用法代码示例。如果您正苦于以下问题:Java WinProcess类的具体用法?Java WinProcess怎么用?Java WinProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WinProcess类属于org.jvnet.winp包,在下文中一共展示了WinProcess类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: killProcessTree
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Override
public boolean killProcessTree(@NotNull Process process) {
if (SystemInfo.isWindows) {
try {
WinProcess winProcess = createWinProcess(process);
winProcess.killRecursively();
return true;
}
catch (Throwable e) {
LOG.info("Cannot kill process tree", e);
}
}
else if (SystemInfo.isUnix) {
return UnixProcessManager.sendSigKillToProcessTree(process);
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:OSProcessManagerImpl.java
示例2: stop
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
public synchronized void stop() {
// make sure we are in the correct state
if (getStatus() != Status.RUNNING &&
getStatus() != Status.STARTING_UP)
{
throw new IllegalStateException("Can't stop runner in " +
getStatus() + " state");
}
setStatus(Status.SHUTTING_DOWN);
// workaround for Windows issue when stopping a process. Use
// an external library that does a better job stopping
// processes than Process.destroy()
if (System.getProperty("os.name").startsWith("Windows")) {
WinProcess wp = new WinProcess(proc);
wp.killRecursively();
} else {
proc.destroy();
}
}
开发者ID:josmas,项目名称:openwonderland,代码行数:22,代码来源:BaseRunner.java
示例3: killProcessTree
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Override
public boolean killProcessTree(@NotNull Process process) {
if (SystemInfo.isWindows) {
try {
new WinProcess(process).killRecursively();
return true;
}
catch (Throwable e) {
LOG.info("Cannot kill process tree");
LOG.info(e);
}
}
else if (SystemInfo.isUnix) {
return UnixProcessManager.sendSigKillToProcessTree(process);
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:OSProcessManagerImpl.java
示例4: killProcessTree
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Override
public boolean killProcessTree(@Nonnull Process process) {
if (SystemInfo.isWindows) {
try {
WinProcess winProcess = createWinProcess(process);
winProcess.killRecursively();
return true;
}
catch (Throwable e) {
LOG.info("Cannot kill process tree", e);
}
}
else if (SystemInfo.isUnix) {
return UnixProcessManager.sendSigKillToProcessTree(process);
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:OSProcessManagerImpl.java
示例5: killProcessAndItsChildren
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
/**
* Kill started process and makes best effort to kill its children processes.<br />
* Warning is logged if issues is detected.<br />
* Note that this might be invoked after some time if not sure that all child processes are already started.
*/
public void killProcessAndItsChildren() {
if (OperatingSystemType.getCurrentOsType().isUnix()) {
// first kill child processes because otherwise their parent ID is changed to 1
int pid = getProcessId();
String command = "pkill -P " + pid;
if (log.isDebugEnabled()) {
log.debug("Try to destroy child processes with '" + command + "'");
}
int exitCode = -1;
try {
exitCode = Runtime.getRuntime().exec(command).waitFor();
} catch (Exception e) {
throw new ProcessExecutorException("Could not kill the process with id '" + pid + "'", e);
}
killProcess(); // kill this process
if (exitCode != 0) {
log.warn("Error while trying to kill subprocesses. Exit code returned from '" + command
+ "' command: " + exitCode);
}
} else if (OperatingSystemType.getCurrentOsType().isWindows()) { // Windows assumed
// use org.jvnet.winp.WinProcess
log.debug("Windows detected and will try to kill whole subtree.");
new WinProcess(theProcess).killRecursively();
} else {
throw new IllegalStateException("Not supported operating system type. Report the case to ATS team");
}
}
开发者ID:Axway,项目名称:ats-framework,代码行数:40,代码来源:ProcessUtils.java
示例6: setProcess
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Override
void setProcess(CdpProcess process) {
WinProcess winProcess = new WinProcess(process.getProcess());
pid = winProcess.getPid();
cdp4jId = winProcess.getEnvironmentVariables().get("CDP4J_ID");
}
开发者ID:webfolderio,项目名称:cdp4j,代码行数:7,代码来源:WindowsProcessManager.java
示例7: convertToWinProcess
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@NotNull
private WinProcess convertToWinProcess(@NotNull final Process process) {
// copied from com.intellij.execution.process.impl.OSProcessManagerImpl#createWinProcess
if (process instanceof RunnerWinProcess) {
return new WinProcess(((RunnerWinProcess)process).getOriginalProcess());
}
else {
return new WinProcess(process);
}
}
开发者ID:ktisha,项目名称:TheRPlugin,代码行数:12,代码来源:TheRXProcessHandler.java
示例8: main
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("You have to give a regular expression in parameter (ex: .*proactive.*)");
System.exit(1);
}
final String regex = args[0];
Iterable<WinProcess> allProcess = WinProcess.all();
for (WinProcess process : allProcess) {
try {
String commandLine = process.getCommandLine();
// System.out.println("COMMAND LINE: " + commandLine);
if (commandLine.matches(".*" + WindowsCleaner.class.getName() + ".*")) {
// System.out.println(process.getPid() + " is a Windows Cleaner");
} else {
if (commandLine.matches(regex)) {
// System.out.println(process.getPid() + " matches " + regex);
process.killRecursively();
System.out.println("Killed " + process.getPid() + " " + commandLine);
} else {
// System.out.println(process.getPid() + " do not match " + regex);
}
}
} catch (WinpException e) {
// Miam Miam Miam
}
}
}
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:31,代码来源:WindowsCleaner.java
示例9: createWinProcess
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Nonnull
private static WinProcess createWinProcess(@Nonnull Process process) {
if (process instanceof RunnerWinProcess) {
RunnerWinProcess runnerWinProcess = (RunnerWinProcess) process;
return new WinProcess(runnerWinProcess.getOriginalProcess());
}
return new WinProcess(process);
}
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:OSProcessManagerImpl.java
示例10: createWinProcess
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@NotNull
private static WinProcess createWinProcess(@NotNull Process process) {
if (process instanceof RunnerWinProcess) process = ((RunnerWinProcess)process).getOriginalProcess();
return new WinProcess(process);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:OSProcessManagerImpl.java
示例11: Windows
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
Windows() {
for (final WinProcess p : WinProcess.all()) {
int pid = p.getPid();
if (pid == 0 || pid == 4)
continue; // skip the System Idle and System processes
super.processes.put(pid, new OSProcess(pid) {
private EnvVars env;
private List<String> args;
public OSProcess getParent() {
// windows process doesn't have parent/child relationship
return null;
}
public void killRecursively() throws InterruptedException {
LOGGER.finer("Killing recursively " + getPid());
p.killRecursively();
}
public void kill() throws InterruptedException {
LOGGER.finer("Killing " + getPid());
p.kill();
}
@Override
public synchronized List<String> getArguments() {
if (args == null)
args = Arrays.asList(QuotedStringTokenizer.tokenize(p.getCommandLine()));
return args;
}
@Override
public synchronized EnvVars getEnvironmentVariables() {
if (env != null)
return env;
env = new EnvVars();
try {
env.putAll(p.getEnvironmentVariables());
} catch (WinpException e) {
LOGGER.log(FINE, "Failed to get environment variable ", e);
}
return env;
}
});
}
}
开发者ID:ow2-proactive,项目名称:process-tree-killer,代码行数:50,代码来源:ProcessTree.java
示例12: get
import org.jvnet.winp.WinProcess; //导入依赖的package包/类
@Override
public OSProcess get(Process proc) {
return get(new WinProcess(proc).getPid());
}
开发者ID:ow2-proactive,项目名称:process-tree-killer,代码行数:5,代码来源:ProcessTree.java
注:本文中的org.jvnet.winp.WinProcess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论