Package gnu.cajo

Class Cajo.Registrar

  • Enclosing class:
    Cajo

    public static final class Cajo.Registrar
    extends java.lang.Object
    This internal use only helper class maintains a registry of exported objects. It cannot be instantiated outside this class, it is made public only because it is being invoked reflectively. It uses UDP multicasts to find other instances of registries, and shares references between them.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Vector items  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Registrar​(java.util.Vector items)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object multicast​(Multicast multicast)
      This method is called either when a Cajo instance starts up, or exports an object reference.
      void register​(java.util.Vector elements)
      This method is called either by remote JVMs to provide a copy of their registry, in response to a startup or export announcement.
      java.util.Vector request()
      This method allows remote JVMs to request the contents of the registry.
      • Methods inherited from class java.lang.Object

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

      • items

        private final java.util.Vector items
    • Constructor Detail

      • Registrar

        private Registrar​(java.util.Vector items)
    • Method Detail

      • multicast

        public java.lang.Object multicast​(Multicast multicast)
                                   throws java.lang.Exception
        This method is called either when a Cajo instance starts up, or exports an object reference. All operating servers will request the collection of references owned by the remote JVM, and correspondingly send a copy of their registries.
        Parameters:
        multicast - A reference to the announcing JVM
        Returns:
        null To keep the multicast object listening
        Throws:
        java.lang.Exception - if the request for remote references failed, or the sending its reference collection failed, for either network, or application specific reasons.
      • register

        public void register​(java.util.Vector elements)
        This method is called either by remote JVMs to provide a copy of their registry, in response to a startup or export announcement. The registries will be merged, and duplicate references discarded.
        Parameters:
        elements - A collection of remote object references
      • request

        public java.util.Vector request()
        This method allows remote JVMs to request the contents of the registry. The contents of the registry are dynamic, changing with the exports, and shutdowns, of remote servers.
        Returns:
        The collection of remote object references currently registered