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


Java NetworkServerControl.ping方法代码示例

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


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

示例1: startNetworkServer

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public static NetworkServerControl startNetworkServer(final int netPort)
    throws Exception {
  getLogWriter().info(
      "Starting a Derby Network Server on "
          + InetAddress.getLocalHost().getHostName() + ":" + netPort);
  NetworkServerControl server = new NetworkServerControl(
      InetAddress.getLocalHost(), netPort);
  // send the output to derby logs
  server.start(SanityManager.GET_DEBUG_STREAM());
  // wait for n/w server to initialize completely
  while (true) {
    Thread.sleep(500);
    try {
      server.ping();
      break;
    }
    catch (Exception e) {
    }
  }
  server.logConnections(true);
  return server;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:23,代码来源:DBSynchronizerTestBase.java

示例2: isServerStarted

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
private static boolean isServerStarted(NetworkServerControl server, int ntries)
{
    for (int i = 1; i <= ntries; i ++)
    {
        try {
            Thread.sleep(500);
            server.ping();
            return true;
        }
        catch (Exception e) {
            if (i == ntries)
                return false;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:airavata,代码行数:17,代码来源:Initialize.java

示例3: waitForDerbyInitialization

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public static void waitForDerbyInitialization(NetworkServerControl server)
    throws InterruptedException {
  for (int tries = 1; tries <= 20; tries++) {
    try {
      server.ping();
      break;
    } catch (Throwable t) {
      Thread.sleep(1000);
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:12,代码来源:ClientServerDUnit.java

示例4: startDatabase

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
@BeforeClass
public static void startDatabase() throws Exception {
  ServerSocket socket = new ServerSocket(0);
  port = socket.getLocalPort();
  socket.close();

  LOG.info("Starting Derby database on {}", port);

  System.setProperty("derby.stream.error.file", "target/derby.log");

  derbyServer = new NetworkServerControl(InetAddress.getByName("localhost"), port);
  StringWriter out = new StringWriter();
  derbyServer.start(new PrintWriter(out));
  boolean started = false;
  int count = 0;
  // Use two different methods to detect when server is started:
  // 1) Check the server stdout for the "started" string
  // 2) wait up to 15 seconds for the derby server to start based on a ping
  // on faster machines and networks, this may return very quick, but on slower
  // networks where the DNS lookups are slow, this may take a little time
  while (!started && count < 30) {
    if (out.toString().contains("started")) {
      started = true;
    } else {
      count++;
      Thread.sleep(500);
      try {
        derbyServer.ping();
        started = true;
      } catch (Throwable t) {
        //ignore, still trying to start
      }
    }
  }

  dataSource = new ClientDataSource();
  dataSource.setCreateDatabase("create");
  dataSource.setDatabaseName("target/beam");
  dataSource.setServerName("localhost");
  dataSource.setPortNumber(port);

  readTableName = JdbcTestHelper.getTableName("UT_READ");

  JdbcTestHelper.createDataTable(dataSource, readTableName);
  addInitialData(dataSource, readTableName);
}
 
开发者ID:apache,项目名称:beam,代码行数:47,代码来源:JdbcIOTest.java


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