Class RoutingTable

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

public class RoutingTable extends Object
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
  • Constructor Details

    • RoutingTable

      public RoutingTable(RoutingTableSpec spec)
      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

      public RoutingTable.HopIterator getHopIterator()
      Returns an iterator for the hops of this table.
      Returns:
      An iterator.
    • getRouteIterator

      public RoutingTable.RouteIterator 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

      public boolean hasHop(String name)
      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

      public HopBlueprint getHop(String name)
      Returns the named hop, may be null.
      Parameters:
      name - The name of the hop to return.
      Returns:
      The hop implementation object.
    • hasRoute

      public boolean hasRoute(String name)
      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

      public Route getRoute(String name)
      Returns the named route, may be null.
      Parameters:
      name - The name of the route to return.
      Returns:
      The route implementation object.
    • toString

      public String toString()
      Overrides:
      toString in class Object