Package java.util.concurrent

Examples of java.util.concurrent.ForkJoinPool.submit()


  public List<Map<String,String>> tbDataLinks(String issueNo,int is_not_full,String userName,boolean onsale) throws InterruptedException, ExecutionException{
    //ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors());
    ForkJoinPool forkJoinPool = new ForkJoinPool(5);
    int detailLinkPages = dataLinkPages(issueNo, is_not_full, userName, onsale);
    TBDataLinkThread thread = new TBDataLinkThread(1,detailLinkPages,issueNo, is_not_full,userName,onsale,this);
        Future<List<Map<String,String>>> result = forkJoinPool.submit(thread);
        forkJoinPool.shutdown();
    return result.get();
  }
 
  public List<String> tbData(List<Map<String,String>> detailLinks) throws InterruptedException, ExecutionException{
View Full Code Here


 
  public List<String> tbData(List<Map<String,String>> detailLinks) throws InterruptedException, ExecutionException{
    ForkJoinPool forkJoinPool = new ForkJoinPool(5);
    int size = detailLinks.size();
    TBDataThread thread = new TBDataThread(0,size-1,detailLinks,this);
        Future<List<String>> result = forkJoinPool.submit(thread);
        forkJoinPool.shutdown();
    return result.get();
  }
 
  private int dataLinkPages(String issueNo,int is_not_full,String userName,boolean onsale){
View Full Code Here

    }
 
  public void readDataLink() throws InterruptedException, ExecutionException{
    ForkJoinPool forkJoinPool = new ForkJoinPool(10);
        ForkJoinFirst firstTask = new ForkJoinFirst(1,150,this);
        Future<List<String>> result = forkJoinPool.submit(firstTask);
        System.out.println(result.get().size());
        forkJoinPool.shutdown();
  }

  public List<String> readData(Integer pageNo) {
View Full Code Here

    }
  @Test
    public void testA() throws Exception{
    long b = System.currentTimeMillis();
        ForkJoinPool forkJoinPool = new ForkJoinPool();
        Future<Integer> result = forkJoinPool.submit(new Calculator(0, max));
        System.out.println("testA:"+result.get());
        System.out.println("testA:"+(System.currentTimeMillis()-b));
        //assertEquals(new Integer(49995000), result.get());
    }
 
View Full Code Here

  public List<String> wyDataLinks(String issueNo,int is_not_full) throws InterruptedException, ExecutionException{
    //ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors());
    ForkJoinPool forkJoinPool = new ForkJoinPool(5);
    int linkPages = dataLinkPages(issueNo, is_not_full);
    DataLinkThread thread = new DataLinkThread(1,linkPages,issueNo, is_not_full,this);
        Future<List<String>> result = forkJoinPool.submit(thread);
        forkJoinPool.shutdown();
    return result.get();
  }
 
  public List<String> wyDatas(List<String> lottOrderIds) throws InterruptedException, ExecutionException{
View Full Code Here

 
  public List<String> wyDatas(List<String> lottOrderIds) throws InterruptedException, ExecutionException{
    ForkJoinPool forkJoinPool = new ForkJoinPool(5);
    int size = lottOrderIds.size();
    DataThread thread = new DataThread(0,size-1,lottOrderIds,this);
        Future<List<String>> result = forkJoinPool.submit(thread);
        forkJoinPool.shutdown();
    return result.get();
  }
 
 
View Full Code Here

      b = System.currentTimeMillis();
      ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors());
      int linkPages = wyService.dataLinkPages("2014043", 3);
      DataLinkThread thread = new DataLinkThread(1,linkPages);
      thread.setTarget(thread);
          Future<List<String>> result = forkJoinPool.submit(thread);
          forkJoinPool.shutdown();
         //System.out.println("ForkJoin:size:"+result.get().size()+" time:"+(System.currentTimeMillis()-b));
    //}
       
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.