Exemplo n.º 1
0
  public void run() {
    // initial server start
    try {
      synchronized (testState) {
        if (testState.isRunning()) {
          System.err.println("Starting server...");
          server.start();
        }
      }
    } catch (Exception e) {
      throw new TCRuntimeException(e);
    }

    while (true) {
      ThreadUtil.reallySleep(crashInterval);
      synchronized (testState) {
        if (testState.isRunning()) {
          try {
            System.err.println("Crashing server...");
            if (proxyConnectMode) {
              ProxyConnectManagerImpl.getManager().stopProxyTest();
              ProxyConnectManagerImpl.getManager().proxyDown();
            }
            server.crash();

            if (server.isRunning())
              throw new AssertionError("Server is still running even after shutdown or crash.");

            System.err.println("Starting server...");
            server.start();
            if (proxyConnectMode) {
              ProxyConnectManagerImpl.getManager().proxyUp();
              ProxyConnectManagerImpl.getManager().startProxyTest();
            }

          } catch (Exception e) {
            throw new TCRuntimeException(e);
          }
        } else {
          System.err.println("Shutting down server crasher.");
          break;
        }
      }
    }
  }
Exemplo n.º 2
0
 public void startAutocrash() throws Exception {
   testState.setTestState(TestState.RUNNING);
   myThread.start();
 }