Package org.jetlang.fibers

Examples of org.jetlang.fibers.PoolFiberFactory


   */
  public static Fiber pooledFiber(Lane<String,ExecutorService> lane)
  {
    if(null == lanePoolFactoryMap.get(lane))
    {
      lanePoolFactoryMap.putIfAbsent(lane, new PoolFiberFactory(lane.getUnderlyingLane()));
    }
   
    Fiber fiber = lanePoolFactoryMap.get(lane).create();
    fiber.start();
    return fiber;
View Full Code Here


   
    private final ExecutorService      pool    = Executors.newCachedThreadPool();
    private final List<Fiber>          fibers  = new ArrayList<Fiber>();
   
    public Downloader() {
        PoolFiberFactory f = new PoolFiberFactory(pool);
        //subscribe multiple fibers for parallel execution
        for(int i = 0, numThreads = 10; i < numThreads; i++) {
            Fiber fiber = f.create();
            fiber.start();
            fibers.add(fiber);
            channel.subscribe(fiber, new DownloadCallback());
        }
    }
View Full Code Here

    private final ExecutorService      pool    = Executors.newCachedThreadPool();
    private final List<Fiber>          fibers  = new ArrayList<>();

    public Downloader() {
        PoolFiberFactory f = new PoolFiberFactory(pool);
        //subscribe multiple fibers for parallel execution
        for(int i = 0, numThreads = 10; i < numThreads; i++) {
            Fiber fiber = f.create();
            fiber.start();
            fibers.add(fiber);
            channel.subscribe(fiber, new DownloadCallback());
        }
    }
View Full Code Here

  @Override
  protected void configure() {
    install(new StateModule(timeout));

    PoolFiberFactory fiberFactory = new PoolFiberFactory(executor);

    Fiber raftFiber = fiberFactory.create(new BatchExecutor());
    raftFiber.start();
    bind(Fiber.class).annotatedWith(RaftExecutor.class).toInstance(raftFiber);

    Fiber stateMachineFiber = fiberFactory.create(new BatchExecutor());
    stateMachineFiber.start();

    install(new LogModule(logDir, stateMachine, stateMachineFiber));

    bind(ClusterConfig.class).toInstance(config);
View Full Code Here

TOP

Related Classes of org.jetlang.fibers.PoolFiberFactory

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.