Class JoinRound

java.lang.Object
io.superdurable.dex.JoinRound

public final class JoinRound extends Object
Identifies one round of a Join and the number of branches started in that round.

Join.fork(Context, List, Function) and Join.forkWithRoundKey(String, List, Function) create the round and pass the same value to every branch builder and to the join builder. Put it in the input of each branch Step, of the join Step, and of the next round's split Step. Treat it as an opaque token: a branch passes it to Join.endBranch(Context, JoinRound, T) or Join.reportBranchResult(Context, JoinRound, T), the join Step passes it to Join.forAllBranches(JoinRound), Join.forFirstBranch(JoinRound), or Join.forBranches(JoinRound, int), and the next split Step passes it to Join.forRemainingBranches(JoinRound, int). The application never counts branches or invents round keys itself.

The round is persisted inside Step inputs as the JSON object {"roundKey": "<key>", "branchCount": <count>}. These field names are stable in every Dex SDK, so a Flow can mix Steps written against different SDK versions. Unknown JSON fields are ignored on decode, so later SDK versions may add fields.

See Join for a complete split, branch, join, and reset example.

Since:
1.44.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    JoinRound(String roundKey, int branchCount)
    Creates a round token.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
    Compares the round key and branch count.
    int
    Returns the number of branches started in this round.
    Returns the round key, which is the ChannelMap instance key that holds this round's branch results.
    int
    Returns a hash code consistent with equals(Object).
    Returns a diagnostic representation with the round key and branch count.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JoinRound

      public JoinRound(String roundKey, int branchCount)
      Creates a round token.

      Applications normally receive rounds from Join.fork(Context, List, Function) or Join.forkWithRoundKey(String, List, Function). Construct one directly only when an RPC must report for a known round, for example to report a result on behalf of a canceled branch. The Join methods validate the values when they use the round, not here, so decoding stored input never fails because of them.

      Parameters:
      roundKey - the ChannelMap instance key of the round; Join methods reject a blank key or a key containing /
      branchCount - the number of branches started in the round; Join methods reject a negative count
  • Method Details

    • getRoundKey

      public String getRoundKey()
      Returns the round key, which is the ChannelMap instance key that holds this round's branch results.

      Join.fork(Context, List, Function) uses the split Step's execution ID, such as RequestQuotes-2, so Dex Web shows the round under the same name as the split Step in history.

      Returns:
      the round key
    • getBranchCount

      public int getBranchCount()
      Returns the number of branches started in this round.

      This equals the number of branch builders passed to Join.fork(Context, List, Function) or Join.forkWithRoundKey(String, List, Function). It may be zero.

      Returns:
      the branch count
    • equals

      public boolean equals(Object other)
      Compares the round key and branch count.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare
      Returns:
      true when other is a round with the same key and branch count
    • hashCode

      public int hashCode()
      Returns a hash code consistent with equals(Object).
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • toString

      public String toString()
      Returns a diagnostic representation with the round key and branch count.
      Overrides:
      toString in class Object
      Returns:
      the diagnostic string