Class ForkJoinExamples

java.lang.Object
jline.examples.java.basic.ForkJoinExamples

public class ForkJoinExamples extends Object
Fork-join network examples mirroring the Kotlin notebooks in forkJoin.

This class contains Java implementations that mirror the Kotlin notebook examples found in jar/src/main/kotlin/jline/examples/kotlin/basic/forkJoin/. Each method demonstrates a specific fork-join concept using models from the basic package.

The examples cover: - Basic fork-join synchronization patterns - Asymmetric and nested fork-join structures - Class switching within fork-join topologies - Complex serial and parallel compositions - Deep nesting and routing overlaps

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Asymmetric fork-join network (fj_asymm.ipynb).
    static void
    Basic closed fork-join network (fj_basic_closed.ipynb).
    static void
    Basic nested fork-join network (fj_basic_nesting.ipynb).
    static void
    Basic open fork-join network (fj_basic_open.ipynb).
    static void
    Complex serial fork-join network (fj_complex_serial.ipynb).
    static void
    Fork-join with class switching and multiple visits (fj_cs_multi_visits.ipynb).
    static void
    Fork-join with post-fork class switching (fj_cs_postfork.ipynb).
    static void
    Fork-join with pre-fork class switching (fj_cs_prefork.ipynb).
    static void
    Deep nested fork-join network (fj_deep_nesting.ipynb).
    static void
    Fork-join with multiple delay stages (fj_delays.ipynb).
    static void
    Fork without join synchronization (fj_nojoin.ipynb).
    static void
    Fork-join with overlapping routes (fj_route_overlap.ipynb).
    static void
    Closed serial fork-join stages (fj_serialfjs_closed.ipynb).
    static void
    Open serial fork-join stages (fj_serialfjs_open.ipynb).
    static void
    Multi-class three-branch fork-join (fj_threebranches.ipynb).
    static void
    Two-class fork-join with task multiplication (fj_twoclasses_forked.ipynb).
    static void
    main(String[] args)
    Main method demonstrating all fork-join examples.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ForkJoinExamples

      public ForkJoinExamples()
  • Method Details

    • fj_asymm

      public static void fj_asymm() throws Exception
      Asymmetric fork-join network (fj_asymm.ipynb).

      Demonstrates an asymmetric fork-join where one branch has serial queues (Queue2→Queue3) while the other has a single queue (Queue1).

      Features: - Closed network with 10 jobs circulating through delay→fork-join - Branch 1: Single Queue1, Branch 2: Serial Queue2→Queue3 - Different service rates creating bottleneck effects - Multiple solver comparison (JMT and MVA)

      Throws:
      Exception
    • fj_basic_closed

      public static void fj_basic_closed() throws Exception
      Basic closed fork-join network (fj_basic_closed.ipynb).

      Demonstrates symmetric fork-join with PS scheduling in closed system.

      Features: - 5 jobs circulating through Delay→Fork→{Queue1,Queue2}→Join→Delay - Symmetric parallel branches with identical service rates (1.0) - PS scheduling for fair sharing within each queue - Multiple solver comparison (JMT and MVA with fork-join extensions)

      Throws:
      Exception
    • fj_basic_nesting

      public static void fj_basic_nesting() throws Exception
      Basic nested fork-join network (fj_basic_nesting.ipynb).

      Shows hierarchical fork-join structures with multiple levels.

      Throws:
      Exception
    • fj_basic_open

      public static void fj_basic_open() throws Exception
      Basic open fork-join network (fj_basic_open.ipynb).

      Demonstrates fundamental fork-join synchronization with open arrivals, showing parallel processing and synchronization effects.

      Features: - Fork splits jobs into parallel streams for processing - Two FCFS queues with different service rates (1.0 and 2.0) - Join synchronizes completion from both parallel branches - Queue2 is faster, so Queue1 becomes the bottleneck - Multiple solver comparison (JMT and MVA)

      Throws:
      Exception
    • fj_complex_serial

      public static void fj_complex_serial() throws Exception
      Complex serial fork-join network (fj_complex_serial.ipynb).

      Demonstrates complex fork-join with serial processing within branches.

      Features: - Fork to two branches with series queues within each branch - Branch 1: Queue1 → Queue4 → Queue5 (3 queues in series) - Branch 2: Queue2 → Queue3 (2 queues in series) - Different service rates creating complex performance interactions - Shows how serial chains within parallel branches affect overall performance

      Throws:
      Exception
    • fj_cs_multi_visits

      public static void fj_cs_multi_visits() throws Exception
      Fork-join with class switching and multiple visits (fj_cs_multi_visits.ipynb).

      Demonstrates feedback loop with class switching in fork-join.

      Features: - Two open classes: Class1 with arrivals, Class2 generated internally - Router node creates feedback from Join back to Fork - Class switching capabilities showing job transformation - PS scheduling for fair resource sharing - Feedback loop creates multiple visits to fork-join structure

      Throws:
      Exception
    • fj_cs_postfork

      public static void fj_cs_postfork() throws Exception
      Fork-join with post-fork class switching (fj_cs_postfork.ipynb).

      Shows class switching after fork splitting.

      Features: - Two closed classes with 1 job each - Class switching occurs after fork via router nodes - Router nodes between Fork and Queue nodes enable class transformation - PS queues with identical service rates for fairness - Demonstrates how jobs can change class during fork-join processing

      Throws:
      Exception
    • fj_cs_prefork

      public static void fj_cs_prefork() throws Exception
      Fork-join with pre-fork class switching (fj_cs_prefork.ipynb).

      Demonstrates class switching before fork operation.

      Features: - Two closed classes with 10 jobs each - Class switching happens before entering fork-join structure - Delay1 → Delay2 path with class transformation - Only transformed jobs enter the fork-join section - Shows selective fork-join participation based on job class

      Throws:
      Exception
    • fj_deep_nesting

      public static void fj_deep_nesting() throws Exception
      Deep nested fork-join network (fj_deep_nesting.ipynb).

      Shows complex hierarchical fork-join structures.

      Features: - Nested fork-join: Fork1 splits to Queue1 and Queue2 - Queue1 leads to Fork2 which splits to Queue3 and Queue4 - Creates asymmetric tree structure with deeper nesting on one side - Single job to clearly show synchronization behavior - Demonstrates how nested fork-joins affect response times

      Throws:
      Exception
    • fj_delays

      public static void fj_delays() throws Exception
      Fork-join with multiple delay stages (fj_delays.ipynb).

      Demonstrates impact of sequential delays before fork-join.

      Features: - Two delay nodes in series before fork-join structure - Delay1 (rate 0.5) → Delay2 (rate 2.0) → Fork - Symmetric parallel queues after fork (both rate 1.0) - Shows how pre-processing delays affect fork-join performance - 10 jobs circulating in closed system

      Throws:
      Exception
    • fj_nojoin

      public static void fj_nojoin() throws Exception
      Fork without join synchronization (fj_nojoin.ipynb).

      Shows fork splitting without synchronization requirement.

      Features: - Fork splits arrivals to three PS queues - No Join node - jobs exit independently to sink - Probabilistic routing: 1/3 to each queue - Different service rates: Queue1(1.0), Queue2(0.5), Queue3(0.333) - Demonstrates load balancing without synchronization overhead

      Throws:
      Exception
    • fj_route_overlap

      public static void fj_route_overlap() throws Exception
      Fork-join with overlapping routes (fj_route_overlap.ipynb).

      Three-way fork-join demonstrating route overlap effects.

      Features: - Fork splits to three FCFS queues simultaneously - Different service rates: Queue1(1.0), Queue2(2.0), Queue3(3.0) - Join waits for all three branches to complete - Queue1 is fastest, Queue3 is slowest (bottleneck) - Shows impact of slowest branch on overall response time

      Throws:
      Exception
    • fj_serialfjs_closed

      public static void fj_serialfjs_closed() throws Exception
      Closed serial fork-join stages (fj_serialfjs_closed.ipynb).

      Two fork-join stages in series within closed network.

      Features: - First stage: Fork1 → {Queue1, Queue2} → Join1 - Second stage: Fork2 → {Queue3, Queue4} → Join2 - 10 jobs circulating through Delay → Stage1 → Stage2 → Delay - All queues PS with identical service rates (1.0) - Shows cumulative effect of cascaded fork-join stages

      Throws:
      Exception
    • fj_serialfjs_open

      public static void fj_serialfjs_open() throws Exception
      Open serial fork-join stages (fj_serialfjs_open.ipynb).

      Cascaded fork-join stages with open arrivals.

      Features: - External arrivals at rate 2.5 - Two fork-join stages in series - Stage 1: Fork1 → {Queue1, Queue2} → Join1 - Stage 2: Fork2 → {Queue3, Queue4} → Join2 - All queues FCFS with identical service rates - Demonstrates pipeline parallelism with synchronization points

      Throws:
      Exception
    • fj_threebranches

      public static void fj_threebranches() throws Exception
      Multi-class three-branch fork-join (fj_threebranches.ipynb).

      Asymmetric fork-join with three branches and two classes.

      Features: - Two closed classes with 10 jobs each - Fork splits to three PS queues - Queue2 → Queue3 creates series within middle branch - Different service rates for each class at each queue - Shows multi-class interaction in asymmetric fork-join topology

      Throws:
      Exception
    • fj_twoclasses_forked

      public static void fj_twoclasses_forked() throws Exception
      Two-class fork-join with task multiplication (fj_twoclasses_forked.ipynb).

      Multi-class fork-join with different task multiplicity.

      Features: - Two open classes with arrival rate 0.25 each - Fork creates 2 tasks per link (task multiplication) - PS scheduling for resource sharing between classes - Class2 has immediate service at Queue1, exponential at Queue2 - Shows effect of task multiplication on system performance

      Throws:
      Exception
    • main

      public static void main(String[] args) throws Exception
      Main method demonstrating all fork-join examples.
      Throws:
      Exception