Class RoutingNodeIterator

java.lang.Object
com.yahoo.messagebus.routing.RoutingNodeIterator

public class RoutingNodeIterator extends Object
Implements an iterator for routing nodes. Use RoutingContext.getChildIterator() to retrieve an instance of this.
Author:
Simon Thoresen Hult
  • Constructor Details

    • RoutingNodeIterator

      public RoutingNodeIterator(List<RoutingNode> children)
      Constructs a new iterator based on a given list.
      Parameters:
      children - The list to iterate through.
  • Method Details

    • next

      public RoutingNodeIterator next()
      Steps to the next child in the map.
      Returns:
      This, to allow chaining.
    • skip

      public RoutingNodeIterator skip(int num)
      Skips the given number of children.
      Parameters:
      num - The number of children to skip.
      Returns:
      This, to allow chaining.
    • isValid

      public boolean isValid()
      Returns whether or not this iterator is valid.
      Returns:
      True if we are still pointing to a valid entry.
    • getRoute

      public Route getRoute()
      Returns the route of the current child.
      Returns:
      The route.
    • hasReply

      public boolean hasReply()
      Returns whether or not a reply is set in the current child.
      Returns:
      True if a reply is available.
    • removeReply

      public Reply removeReply()
      Removes and returns the reply of the current child. This is the correct way of reusing a reply of a child node, the getReplyRef() should be used when just inspecting a child reply.
      Returns:
      The reply.
    • getReplyRef

      public Reply getReplyRef()
      Returns the reply of the current child. It is VERY important that the reply returned by this function is not reused anywhere. This is a reference to another node's reply, do NOT use it for anything but inspection. If you want to retrieve and reuse it, call removeReply() instead.
      Returns:
      The reply.