Package com.yahoo.messagebus.routing
Class RoutingTable
java.lang.Object
com.yahoo.messagebus.routing.RoutingTable
At any time there may only ever be zero or one routing table registered in message bus for each protocol. This class
contains a list of named hops and routes that may be used to substitute references to these during route resolving.
- Author:
- Simon Thoresen Hult
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Implements an iterator for the hops of this.static class
Implements an iterator for the routes of this. -
Constructor Summary
ConstructorDescriptionRoutingTable
(RoutingTableSpec spec) Creates a new routing table based on a given specification. -
Method Summary
Modifier and TypeMethodDescriptionReturns the named hop, may be null.Returns an iterator for the hops of this table.int
Returns the number of hops that are contained in this.int
Returns the number of routes that are contained in this.Returns the named route, may be null.Returns an iterator for the routes of this table.boolean
Returns whether or not there exists a named hop in this.boolean
hasHops()
Returns whether or not there are any hops in this routing table.boolean
Returns whether or not there exists a named route in this.boolean
Returns whether or not there are any routes in this routing table.toString()
-
Constructor Details
-
RoutingTable
Creates a new routing table based on a given specification. This also verifies the integrity of the table.- Parameters:
spec
- The specification to use.
-
-
Method Details
-
hasHops
public boolean hasHops()Returns whether or not there are any hops in this routing table.- Returns:
- True if there is at least one hop.
-
getNumHops
public int getNumHops()Returns the number of hops that are contained in this.- Returns:
- The number of hops.
-
getHopIterator
Returns an iterator for the hops of this table.- Returns:
- An iterator.
-
getRouteIterator
Returns an iterator for the routes of this table.- Returns:
- An iterator.
-
hasRoutes
public boolean hasRoutes()Returns whether or not there are any routes in this routing table.- Returns:
- True if there is at least one route.
-
getNumRoutes
public int getNumRoutes()Returns the number of routes that are contained in this.- Returns:
- The number of routes.
-
hasHop
Returns whether or not there exists a named hop in this.- Parameters:
name
- The name of the hop to look for.- Returns:
- True if the named hop exists.
-
getHop
Returns the named hop, may be null.- Parameters:
name
- The name of the hop to return.- Returns:
- The hop implementation object.
-
hasRoute
Returns whether or not there exists a named route in this.- Parameters:
name
- The name of the route to look for.- Returns:
- True if the named route exists.
-
getRoute
Returns the named route, may be null.- Parameters:
name
- The name of the route to return.- Returns:
- The route implementation object.
-
toString
-