• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProcessListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.zeroturnaround.exec.listener.ProcessListener的典型用法代码示例。如果您正苦于以下问题:Java ProcessListener类的具体用法?Java ProcessListener怎么用?Java ProcessListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProcessListener类属于org.zeroturnaround.exec.listener包,在下文中一共展示了ProcessListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processEventsAreLogged

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@Test
public void processEventsAreLogged() throws Exception {
  rabbitMqCommand = new RabbitMqCommand(configBuilder.build(), command);
  rabbitMqCommand.call();

  ArgumentCaptor<ProcessListener> listenerCaptor = ArgumentCaptor.forClass(ProcessListener.class);
  verify(processExecutor, atLeastOnce()).addListener(listenerCaptor.capture());

  List<ProcessListener> listeners = listenerCaptor.getAllValues();
  boolean found = false;
  for (ProcessListener listener : listeners) {
    if (listener instanceof LoggingProcessListener){
      found = true;
      break;
    }
  }
  assertThat("Expected Listener was not found!", found, is(true));
}
 
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:19,代码来源:RabbitMqCommandTest.java


示例2: WaitForProcess

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
public WaitForProcess(Process process, ProcessAttributes attributes, ProcessStopper stopper, ProcessCloser closer, ByteArrayOutputStream out, ProcessListener listener, MessageLogger messageLogger) {
  this.process = process;
  this.attributes = attributes;
  this.stopper = stopper;
  this.closer = closer;
  this.out = out;
  this.listener = listener;
  this.messageLogger = messageLogger;
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:10,代码来源:WaitForProcess.java


示例3: processEventsCanBeListenedTo

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@Test
public void processEventsCanBeListenedTo() throws Exception {
  ProcessListener fakeListener = Mockito.mock(ProcessListener.class);

  rabbitMqCommand = new RabbitMqCommand(configBuilder.build(), command);
  rabbitMqCommand.listenToEvents(fakeListener);
  rabbitMqCommand.call();

  ArgumentCaptor<ProcessListener> listenerCaptor = ArgumentCaptor.forClass(ProcessListener.class);
  verify(processExecutor, atLeastOnce()).addListener(listenerCaptor.capture());

  List<ProcessListener> listeners = listenerCaptor.getAllValues();
  assertThat(listeners, hasItem(equalTo(fakeListener)));
}
 
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:15,代码来源:RabbitMqCommandTest.java


示例4: buildProcessExecutor

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@SuppressWarnings("all")
private ProcessExecutor buildProcessExecutor() {
    List<String> commandLine = new ArrayList<>();
    String javaHome = System.getProperty("java.home");
    String javaBin = javaHome + File.separator + "bin" + File.separator + "java";

    commandLine.add(javaBin);
    if (jpdaPort > 0) {
        LOG.info("Listening for jpda connection at " + jpdaPort);
        commandLine.add("-Xdebug");
        commandLine.add(String.format("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%s", jpdaPort));
    }
    if (StringUtils.isNotBlank(jvmArgs)){
        Arrays.stream(jvmArgs.split(" "))
                .filter(arg->arg.length()>0)
                .forEach(arg->commandLine.add(arg));
    }
    commandLine.add("-Dapplication.mode=dev");
    commandLine.add("-cp");
    commandLine.add(classpath);
    commandLine.add(mainClass);

    return new ProcessExecutor(commandLine)
        .directory(mavenBaseDir)
        .destroyOnExit()
        .addListener(new ProcessListener() {
            @Override
            public void afterStop(Process process) {
                if (!restarting.get()) {
                    LOG.error("JVM process terminated (next file change will attempt to restart it)");
                }
            }
        })
        .redirectErrorStream(true)
        .redirectOutput(this.outputStream);
}
 
开发者ID:svenkubiak,项目名称:mangooio,代码行数:37,代码来源:Runner.java


示例5: listeningToEventsWith

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
 * Use this method to register a listener to be notified of process events, like start, stop, etc.
 */
public RabbitMqServer listeningToEventsWith(ProcessListener listener) {
  this.listener = listener;
  return this;
}
 
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:8,代码来源:RabbitMqServer.java


示例6: listenToEvents

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
 * Registers a unique listener to be notified of process events, such as start and finish.
 */
public RabbitMqCommand listenToEvents(ProcessListener listener) {
  this.eventsListener = listener;
  return this;
}
 
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:8,代码来源:RabbitMqCommand.java


示例7: addListener

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
 * Register new process event handler.
 * @param listener process event handler to be added.
 *
 * @return This process executor.
 */
public ProcessExecutor addListener(ProcessListener listener) {
  listeners.add(listener);
  return this;
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java


示例8: removeListener

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
 * Unregister existing process event handler.
 * @param listener process event handler to be removed.
 *
 * @return This process executor.
 */
public ProcessExecutor removeListener(ProcessListener listener) {
  listeners.remove(listener);
  return this;
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java


示例9: removeListeners

import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
 * Unregister existing process event handlers of given type or its sub-types.
 * @param listenerType process event handler type.
 *
 * @return This process executor.
 */
public ProcessExecutor removeListeners(Class<? extends ProcessListener> listenerType) {
  listeners.removeAll(listenerType);
  return this;
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java



注:本文中的org.zeroturnaround.exec.listener.ProcessListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TreeBidiMap类代码示例发布时间:2022-05-23
下一篇:
Java ParseMode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap