Class BNSService


  • public final class BNSService
    extends java.lang.Object
    This is the service object used to register and resolve barrier names with a Barrier Name Server. This provides a client front end.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private NetChannelInput fromBNS
      The incoming channel to receive messages from the BNS
      private NetChannelOutput toBNS
      The channel to send messages to the BNS upon
    • Constructor Summary

      Constructors 
      Constructor Description
      BNSService​(NodeID bnsNode)
      Creates a new BNSService
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean register​(java.lang.String name, NetBarrier bar)
      Registers a Server end of a NetBarrier with the BNS
      NetBarrierLocation resolve​(java.lang.String name)
      Resolves a name on the BNS, retrieving the NetBarrierLocation for the NetBarrier
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • toBNS

        private final NetChannelOutput toBNS
        The channel to send messages to the BNS upon
      • fromBNS

        private final NetChannelInput fromBNS
        The incoming channel to receive messages from the BNS
    • Constructor Detail

      • BNSService

        public BNSService​(NodeID bnsNode)
                   throws JCSPNetworkException
        Creates a new BNSService
        Parameters:
        bnsNode - The Node that the BNS is on
        Throws:
        JCSPNetworkException - Thrown if something goes wrong in the underlying architecture
    • Method Detail

      • register

        public boolean register​(java.lang.String name,
                                NetBarrier bar)
        Registers a Server end of a NetBarrier with the BNS
        Parameters:
        name - Name to register with BNS
        bar - Barrier to register
        Returns:
        True if the name was registered successfully, false otherwise
      • resolve

        public NetBarrierLocation resolve​(java.lang.String name)
                                   throws JCSPNetworkException
        Resolves a name on the BNS, retrieving the NetBarrierLocation for the NetBarrier
        Parameters:
        name - The name to resolve from the BNS
        Returns:
        The NetBarrierLocation of the NetBarrier declared with name
        Throws:
        JCSPNetworkException - Thrown if something goes wrong in the underlying architecture