Package java.util.concurrent

Examples of java.util.concurrent.ForkJoinPool$ForkJoinWorkerThreadFactory


  }
 
  /**Bounds calculation.  Is run in parallel using the tuning parameters of ParallelRenderer.**/
  public Rectangle2D bounds() {
    if (bounds == null) {
      ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors());
      bounds = pool.invoke(
          new BoundsTask<>(
              this,
              ParallelRenderer.RENDER_POOL_SIZE
                * ParallelRenderer.RENDER_THREAD_LOAD));
    }
 
View Full Code Here


  }
 
 
  public Rectangle2D bounds(int m) {
    int procs = Runtime.getRuntime().availableProcessors();
    ForkJoinPool pool = new ForkJoinPool(procs);
    bounds = pool.invoke(new BoundsTask<>(this, m*procs));
    return bounds;
  }
View Full Code Here

    public MetricsForkJoinPoolMonitor(String name, ForkJoinPool fjPool) {
        super(name, fjPool);
        Metrics.register(metric(name, "status"), new Gauge<Status>() {
            @Override
            public Status getValue() {
                final ForkJoinPool fjPool = fjPool();
                if (fjPool.isTerminated()) // Returns true if all tasks have completed following shut down.
                    return ForkJoinPoolMonitor.Status.TERMINATED;
                if (fjPool.isTerminating()) // Returns true if the process of termination has commenced but not yet completed.
                    return ForkJoinPoolMonitor.Status.TERMINATING;
                if (fjPool.isShutdown()) // Returns true if this pool has been shut down.
                    return ForkJoinPoolMonitor.Status.SHUTDOWN;
                if (fjPool.isQuiescent()) // Returns true if all worker threads are currently idle.
                    return ForkJoinPoolMonitor.Status.QUIESCENT;
                return ForkJoinPoolMonitor.Status.ACTIVE;
            }
        });
View Full Code Here

        return name("co.paralleluniverse", "fjPool", poolName, name);
    }

    @Override
    protected ForkJoinPool fjPool() {
        final ForkJoinPool fjPool = super.fjPool();
        if (fjPool == null) {
            unregister();
            throw new RuntimeException("Pool collected");
        }
        return fjPool;
View Full Code Here

    public void unregister() {
    }

    protected ForkJoinPool fjPool() {
        final ForkJoinPool fjp = this.fjPool.get();
        return fjp;
    }
View Full Code Here

        return registered;
    }

    @Override
    protected ForkJoinPool fjPool() {
        final ForkJoinPool fjPool = super.fjPool();
        if (fjPool == null) {
            unregister();
            throw new RuntimeException("Pool collected");
        }
        return fjPool;
View Full Code Here

        return fjPool;
    }

    @Override
    public ForkJoinPoolMonitor.Status getStatus() {
        final ForkJoinPool fjPool = fjPool();
        if (fjPool.isTerminated()) // Returns true if all tasks have completed following shut down.
            return ForkJoinPoolMonitor.Status.TERMINATED;
        if (fjPool.isTerminating()) // Returns true if the process of termination has commenced but not yet completed.
            return ForkJoinPoolMonitor.Status.TERMINATING;
        if (fjPool.isShutdown()) // Returns true if this pool has been shut down.
            return ForkJoinPoolMonitor.Status.SHUTDOWN;
        if (fjPool.isQuiescent()) // Returns true if all worker threads are currently idle.
            return ForkJoinPoolMonitor.Status.QUIESCENT;
        return ForkJoinPoolMonitor.Status.ACTIVE;
    }
View Full Code Here

        return new ExecutorServiceLatencyProbe(fjPool(), 5).fire();
    }
   
    @Override
    public ForkJoinInfo getInfo() {
        final ForkJoinPool fjPool = fjPool();
        int activeThreadCount = fjPool.getActiveThreadCount(); // Returns an estimate of the number of threads that are currently stealing or executing tasks.
        int runningThreadCount = fjPool.getRunningThreadCount(); // Returns an estimate of the number of worker threads that are not blocked waiting to join tasks or for other managed synchronization.
        int queuedSumbmissionCount = fjPool.getQueuedSubmissionCount(); // Returns an estimate of the number of tasks submitted to this pool that have not yet begun executing.
        long queuedTaskCount = fjPool.getQueuedTaskCount(); // Returns an estimate of the total number of tasks currently held in queues by worker threads (but not including tasks submitted to the pool that have not begun executing).
        long stealCount = fjPool.getStealCount(); //  Returns an estimate of the total number of tasks stolen from one thread's work queue by another.

        return new ForkJoinInfo(activeThreadCount, runningThreadCount, queuedSumbmissionCount, queuedTaskCount, stealCount);
    }
View Full Code Here

    }
    Collections.shuffle(lu);
    Update[] updates = lu.toArray(new Update[0]); // Avoid allocation by passing
                                                  // zero-sized array
    MicroBlogUpdateSorter sorter = new MicroBlogUpdateSorter(updates);
    ForkJoinPool pool = new ForkJoinPool(4);
    pool.invoke(sorter);

    for (Update u : sorter.getResult()) {
      System.out.println(u);
    }
  }
View Full Code Here

    public AsyncEventService(int parallelism) {
        this(parallelism, true);
    }

    public AsyncEventService(int parallelism, boolean saveEventStackTrace) {
        this.notificatorPool = new ForkJoinPool(parallelism);
        this.saveEventStackTrace = saveEventStackTrace;
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.ForkJoinPool$ForkJoinWorkerThreadFactory

Copyright © 2018 www.massapicom. 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.