Example #1
0
  @Override
  protected void doRunExample(final Engine engine) throws Exception {
    final int[] toSort = createRandomArray(10, new Random());

    final Task<int[]> mergeSort = mergeSort(toSort, new Range(0, toSort.length));
    engine.run(mergeSort);
    mergeSort.await();

    System.out.println("Before sort: " + Arrays.toString(toSort));
    System.out.println("After  sort: " + Arrays.toString(mergeSort.get()));
    Arrays.sort(toSort);
    System.out.println("Java   sort: " + Arrays.toString(toSort));

    ExampleUtil.printTracingResults(mergeSort);
  }
 public Task<List<Integer>> fetchMailbox(int id) {
   if (mailboxService == null) {
     mailboxService = getService();
   }
   return ExampleUtil.fetch("Mailbox", mailboxService, id, DB.mailboxDB);
 }
 public Task<Message> fetchMessage(int id) {
   if (messageService == null) {
     messageService = getService();
   }
   return ExampleUtil.fetch("Message", messageService, id, DB.messageDB);
 }
 public Task<Company> fetchCompany(int id) {
   if (companyService == null) {
     companyService = getService();
   }
   return ExampleUtil.fetch("Company", companyService, id, DB.companyDB);
 }
 public Task<Person> fetchPerson(int id) {
   if (personService == null) {
     personService = getService();
   }
   return ExampleUtil.fetch("Person", personService, id, DB.personDB);
 }