Package com.yahoo.messagebus.routing
Class RoutingNodeIterator
java.lang.Object
com.yahoo.messagebus.routing.RoutingNodeIterator
Implements an iterator for routing nodes. Use
RoutingContext.getChildIterator()
to retrieve an instance of
this.- Author:
- Simon Thoresen Hult
-
Constructor Summary
ConstructorDescriptionRoutingNodeIterator
(List<RoutingNode> children) Constructs a new iterator based on a given list. -
Method Summary
Modifier and TypeMethodDescriptionReturns the reply of the current child.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.next()
Steps to the next child in the map.Removes and returns the reply of the current child.skip
(int num) Skips the given number of children.
-
Constructor Details
-
RoutingNodeIterator
Constructs a new iterator based on a given list.- Parameters:
children
- The list to iterate through.
-
-
Method Details
-
next
Steps to the next child in the map.- Returns:
- This, to allow chaining.
-
skip
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
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
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
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.
-