当前位置: 首页>>代码示例>>Java>>正文


Java RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces方法代码示例

本文整理汇总了Java中org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces方法的具体用法?Java RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces怎么用?Java RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils的用法示例。


在下文中一共展示了RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils; //导入方法依赖的package包/类
@Override
public void open() throws InterpreterException {
  try {
    if (ipythonClient != null) {
      // IPythonInterpreter might already been opened by PythonInterpreter
      return;
    }
    pythonExecutable = getProperty("zeppelin.python", "python");
    LOGGER.info("Python Exec: " + pythonExecutable);

    ipythonLaunchTimeout = Long.parseLong(
        getProperty("zeppelin.ipython.launch.timeout", "30000"));
    this.zeppelinContext = new PythonZeppelinContext(
        getInterpreterGroup().getInterpreterHookRegistry(),
        Integer.parseInt(getProperty("zeppelin.python.maxResult", "1000")));
    int ipythonPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces();
    int jvmGatewayPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces();
    LOGGER.info("Launching IPython Kernel at port: " + ipythonPort);
    LOGGER.info("Launching JVM Gateway at port: " + jvmGatewayPort);
    ipythonClient = new IPythonClient("127.0.0.1", ipythonPort);
    launchIPythonKernel(ipythonPort);
    setupJVMGateway(jvmGatewayPort);
  } catch (Exception e) {
    throw new RuntimeException("Fail to open IPythonInterpreter", e);
  }
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:27,代码来源:IPythonInterpreter.java

示例2: testStartStop

import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils; //导入方法依赖的package包/类
@Test
public void testStartStop() throws InterruptedException, IOException, TException {
  RemoteInterpreterServer server = new RemoteInterpreterServer(
      RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces());
  assertEquals(false, server.isRunning());

  server.start();
  long startTime = System.currentTimeMillis();
  boolean running = false;

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      running = true;
      break;
    } else {
      Thread.sleep(200);
    }
  }

  assertEquals(true, running);
  assertEquals(true, RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", server.getPort()));

  server.shutdown();

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      Thread.sleep(200);
    } else {
      running = false;
      break;
    }
  }
  assertEquals(false, running);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:35,代码来源:RemoteInterpreterServerTest.java

示例3: testStartStop

import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils; //导入方法依赖的package包/类
@Test
public void testStartStop() throws InterruptedException, IOException, TException {
  RemoteInterpreterServer server = new RemoteInterpreterServer("localhost",
      RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(), ":", true);
  assertEquals(false, server.isRunning());

  server.start();
  long startTime = System.currentTimeMillis();
  boolean running = false;

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      running = true;
      break;
    } else {
      Thread.sleep(200);
    }
  }

  assertEquals(true, running);
  assertEquals(true, RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", server.getPort()));

  server.shutdown();

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      Thread.sleep(200);
    } else {
      running = false;
      break;
    }
  }
  assertEquals(false, running);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:35,代码来源:RemoteInterpreterServerTest.java

示例4: testStartStopWithQueuedEvents

import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils; //导入方法依赖的package包/类
@Test
public void testStartStopWithQueuedEvents() throws InterruptedException, IOException, TException {
  RemoteInterpreterServer server = new RemoteInterpreterServer("localhost",
      RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(), ":", true);
  assertEquals(false, server.isRunning());

  server.start();
  long startTime = System.currentTimeMillis();
  boolean running = false;

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      running = true;
      break;
    } else {
      Thread.sleep(200);
    }
  }

  assertEquals(true, running);
  assertEquals(true, RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", server.getPort()));

  //just send an event on the client queue
  server.eventClient.onAppStatusUpdate("","","","");

  ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

  Runnable task = new ShutdownRun(server);

  executor.schedule(task, 0, TimeUnit.MILLISECONDS);

  while (System.currentTimeMillis() - startTime < 10 * 1000) {
    if (server.isRunning()) {
      Thread.sleep(200);
    } else {
      running = false;
      break;
    }
  }

  executor.shutdown();

  //cleanup environment for next tests
  server.shutdown();

  assertEquals(false, running);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:48,代码来源:RemoteInterpreterServerTest.java


注:本文中的org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。