Пример #1
0
  /**
   * Configure and start the load balancer
   *
   * @throws LoadBalancerExtensionException if configuration or start process fails
   */
  private void configureAndStart() throws LoadBalancerExtensionException {
    // Initialize topology
    if (!topologyEventReceiver.isInitialized()) {
      topologyEventReceiver.initializeTopology();
    }

    // Configure load balancer
    Topology topology = topologyProvider.getTopology();
    if (topologyPopulated(topology) && loadBalancer.configure(topology)) {
      // Start load balancer
      loadBalancer.start();
      loadBalancerStarted = true;
    }
  }
  private void testNodes() throws IOException {
    System.out.println("Start testing.");
    long startTime = System.currentTimeMillis();

    StringReader stringReader = new StringReader(readTestData());
    Instances instances = new Instances(stringReader);
    instances.setClassIndex(instances.numAttributes() - 1);

    System.out.println("Starting testing of " + instances.numInstances() + " instances in total.");
    LoadBalancer loadBalancer = new LoadBalancer(daoList, instances);
    loadBalancer.start();

    long testTime = System.currentTimeMillis() - startTime;
    System.out.println("Finished testing in " + testTime + " ms");
  }