Package com.yahoo.messagebus.routing
Class RoutingNodeIterator
- java.lang.Object
-
- com.yahoo.messagebus.routing.RoutingNodeIterator
-
public class RoutingNodeIterator extends java.lang.Object
Implements an iterator for routing nodes. UseRoutingContext.getChildIterator()
to retrieve an instance of this.- Author:
- Simon Thoresen Hult
-
-
Constructor Summary
Constructors Constructor Description RoutingNodeIterator(java.util.List<RoutingNode> children)
Constructs a new iterator based on a given list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Reply
getReplyRef()
Returns the reply of the current child.Route
getRoute()
Returns the route of the current child.boolean
hasReply()
Returns whether or not a reply is set in the current child.boolean
isValid()
Returns whether or not this iterator is valid.RoutingNodeIterator
next()
Steps to the next child in the map.Reply
removeReply()
Removes and returns the reply of the current child.RoutingNodeIterator
skip(int num)
Skips the given number of children.
-
-
-
Constructor Detail
-
RoutingNodeIterator
public RoutingNodeIterator(java.util.List<RoutingNode> children)
Constructs a new iterator based on a given list.- Parameters:
children
- The list to iterate through.
-
-
Method Detail
-
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, thegetReplyRef()
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, callremoveReply()
instead.- Returns:
- The reply.
-
-