static boolean run(int size, int threads, ExpansionStrategy strategy, long tolerance) {

    OwnerManager.init(threads, strategy);
    createConnector(size, threads);

    PairwiseAsynchrounous.pending = size;
    PairwiseAsynchrounous.start = System.currentTimeMillis();
    PairwiseAsynchrounous.thread = Thread.currentThread();

    try {
      OwnerManager.go();

      Thread.sleep(tolerance);
      thread = null;
      // killed inactive threadpool
      OwnerManager
          .kill(); // threads in the pool throw RejectedExecutionException when cancelling tasks.
      //            System.out.print("-");
      //            interruptToContinue.interrupt();
      return false;
    } catch (InterruptedException e) {
      // successful execution!
      OwnerManager.kill(); // throws RejectedExecutionException to cancelled tasks.
      System.out.print(".");
      ;
      return true;
    } catch (RejectedExecutionException e) {
      System.out.print("** ");
      return false;
    }
  }
  private static void createConnector(int n, int threads) {

    writers = new SinkEnd[n];
    counter = 0;

    SinkEnd snk = createPair();
    AsyncDrain ad = new AsyncDrain();
    snk.connect(ad.getSource1());

    SourceEnd src = ad.getSource2();

    for (int i = 2; i < n; i++) {
      src = addStream(src);
    }

    snk = createPair();
    snk.connect(src);

    // MUST separate in a section per thread.
    // it has 2^height writers
    //        int size = n;
    //        int rest = size % threads;
    //        int firstSection = (int) Math.floor(size/threads);
    //
    //        for (int i=0; i<firstSection; i++) {
    //            for (int thread=0; thread < threads; thread++) {
    //                int next = i+(thread*(firstSection));
    ////                System.out.println("registering: "+next);
    //                OwnerManager.register(writers[next]);
    //            }
    //        }
    //
    //        for (int i=size-rest; i<size; i++) {
    //            ContinuousWriter writer = new ContinuousWriter(1);
    ////            System.out.println("registering: "+i);
    //            OwnerManager.register(writers[i]);
    //        }

    // NEW APPROACH: first the even, then the odd writers.
    for (int i = 0; i < n; i += 2) {
      ContinuousWriter writer = new ContinuousWriter(1);
      //            System.out.println("registering: "+i);
      OwnerManager.register(writers[i]);
    }
    for (int i = 1; i < n; i += 2) {
      ContinuousWriter writer = new ContinuousWriter(1);
      //            System.out.println("registering: "+i);
      OwnerManager.register(writers[i]);
    }
  }