Exemple #1
0
 @Override
 protected void performDelete() throws IOException, InterruptedException {
   // if a build is in progress. Cancel it.
   RunT lb = getLastBuild();
   if (lb != null) {
     Executor e = lb.getExecutor();
     if (e != null) {
       e.interrupt();
       // should we block until the build is cancelled?
     }
   }
   super.performDelete();
 }
  /** {@inheritDoc} */
  @Override
  public void run() {
    List<Grid> clientGrids = runGrid();

    assert clientGrids.size() == clientNodes;

    int threadsCnt = clientNodes * threadsPerClient;

    Executor e = Executors.newFixedThreadPool(threadsCnt);

    for (Grid grid : clientGrids) {
      for (int j = 0; j < threadsPerClient; j++)
        e.execute(new GridJobLoadTestSubmitter(grid, taskParams, cancelRate, submitDelay));
    }
  }
  public static void main(String[] args) throws IOException {
    ServerSocket socket = new ServerSocket(9001);

    while (true) {
      final Socket connection = socket.accept();
      exec.execute(new ConnectionHandlerTask(connection));
    }
  }
Exemple #4
0
 public void run() {
   System.out.println("JSSE Server listening on port " + cipherTest.serverPort);
   Executor exec = Executors.newFixedThreadPool(cipherTest.THREADS, DaemonThreadFactory.INSTANCE);
   try {
     while (true) {
       final SSLSocket socket = (SSLSocket) serverSocket.accept();
       socket.setSoTimeout(cipherTest.TIMEOUT);
       Runnable r =
           new Runnable() {
             public void run() {
               try {
                 InputStream in = socket.getInputStream();
                 OutputStream out = socket.getOutputStream();
                 handleRequest(in, out);
                 out.flush();
                 socket.close();
                 socket.getSession().invalidate();
               } catch (IOException e) {
                 cipherTest.setFailed();
                 e.printStackTrace();
               } finally {
                 if (socket != null) {
                   try {
                     socket.close();
                   } catch (IOException e) {
                     cipherTest.setFailed();
                     System.out.println("Exception closing socket on server side:");
                     e.printStackTrace();
                   }
                 }
               }
             }
           };
       exec.execute(r);
     }
   } catch (IOException e) {
     cipherTest.setFailed();
     e.printStackTrace();
     //
   }
 }
 protected void execute(Runnable runnable) {
   executor.execute(runnable);
 }
  /**
   * @param gridName Grid instance name. Can be {@code null}.
   * @param exec Executor service.
   * @param parentLog Parent logger.
   */
  static void runBackgroundCheck(String gridName, Executor exec, GridLogger parentLog) {
    assert exec != null;
    assert parentLog != null;

    final GridLogger log = parentLog.getLogger(GridDiagnostic.class);

    try {
      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-1", log) {
            @Override
            public void body() {
              try {
                InetAddress localHost = U.getLocalHost();

                if (!localHost.isReachable(REACH_TIMEOUT)) {
                  U.warn(
                      log,
                      "Default local host is unreachable. This may lead to delays on "
                          + "grid network operations. Check your OS network setting to correct it.",
                      "Default local host is unreachable.");
                }
              } catch (IOException ignore) {
                U.warn(
                    log,
                    "Failed to perform network diagnostics. It is usually caused by serious "
                        + "network configuration problem. Check your OS network setting to correct it.",
                    "Failed to perform network diagnostics.");
              }
            }
          });

      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-2", log) {
            @Override
            public void body() {
              try {
                InetAddress localHost = U.getLocalHost();

                if (localHost.isLoopbackAddress()) {
                  U.warn(
                      log,
                      "Default local host is a loopback address. This can be a sign of "
                          + "potential network configuration problem.",
                      "Default local host is a loopback address.");
                }
              } catch (IOException ignore) {
                U.warn(
                    log,
                    "Failed to perform network diagnostics. It is usually caused by serious "
                        + "network configuration problem. Check your OS network setting to correct it.",
                    "Failed to perform network diagnostics.");
              }
            }
          });

      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-3", log) {
            @Override
            public void body() {
              String jdkStrLow = U.jdkString().toLowerCase();

              if (jdkStrLow.contains("jrockit") && jdkStrLow.contains("1.5.")) {
                U.warn(
                    log,
                    "BEA JRockit VM ver. 1.5.x has shown problems with NIO functionality in our "
                        + "tests that were not reproducible in other VMs. We recommend using Sun VM. Should you "
                        + "have further questions please contact us at [email protected]",
                    "BEA JRockit VM ver. 1.5.x is not supported.");
              }
            }
          });

      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-4", log) {
            @Override
            public void body() {
              // Sufficiently tested OS.
              if (!U.isSufficientlyTestedOs()) {
                U.warn(
                    log,
                    "This operating system has been tested less rigorously: "
                        + U.osString()
                        + ". Our team will appreciate the feedback if you experience any problems running "
                        + "gridgain in this environment. You can always send your feedback to [email protected]",
                    "This OS is tested less rigorously: " + U.osString());
              }
            }
          });

      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-5", log) {
            @Override
            public void body() {
              // Fix for GG-1075.
              if (U.allLocalMACs() == null)
                U.warn(
                    log,
                    "No live network interfaces detected. If IP-multicast discovery is used - "
                        + "make sure to add 127.0.0.1 as a local address.",
                    "No live network interfaces. Add 127.0.0.1 as a local address.");
            }
          });

      exec.execute(
          new GridWorker(gridName, "grid-diagnostic-6", log) {
            @Override
            public void body() {
              if (System.getProperty("com.sun.management.jmxremote") != null) {
                String portStr = System.getProperty("com.sun.management.jmxremote.port");

                if (portStr != null)
                  try {
                    Integer.parseInt(portStr);

                    return;
                  } catch (NumberFormatException ignore) {
                  }

                U.warn(
                    log,
                    "JMX remote management is enabled but JMX port is either not set or invalid. "
                        + "Check system property 'com.sun.management.jmxremote.port' to make sure it specifies "
                        + "valid TCP/IP port.",
                    "JMX remote port is invalid - JMX management is off.");
              }
            }
          });
    } catch (RejectedExecutionException e) {
      U.error(
          log,
          "Failed to start background network diagnostics check due to thread pool execution "
              + "rejection. In most cases it indicates a severe configuration problem with GridGain.",
          "Failed to start background network diagnostics.",
          e);
    }
  }