Class Registry

java.lang.Object
gnu.cajo.utils.extra.Registry

public final class Registry extends Object
This class runs as a server. It allows remote VMs to register an object reference with it. Ideally, many instances of the servers would be running on the network. To keep the server memory footprint manageable, only one object is allowed per virtual machine IP address, any subsequent entries overwrite the previous. It also runs a lightwieght task, which periodically runs through the registry, purging object references that have become invalid. To encourage spontaneous internetworking, the registry will announce itself hourly, on the cajo hailing frequency, and listen on it, for other reference announcements; which it will automatically register.
Version:
1.0, 11-Oct-04 Initial release
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Hashtable
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    This method is called by remote VMs, to request a copy of the remote object reference registry.
    Always a good idea; this method describes how to use the registry object, and what its features are.
    static void
    main(String[] args)
    This method is used to start up the registry server.
    void
    multicast(Multicast multicast)
    This method is called solely by this registry's Multicast member object, to register objects of remote server announcements.
    void
    This method statically called by a remote machine to register an object reference.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Registry

      public Registry()
  • Method Details

    • multicast

      public void multicast(Multicast multicast)
      This method is called solely by this registry's Multicast member object, to register objects of remote server announcements.
    • post

      public void post(RemoteInvoke ref) throws ServerNotActiveException
      This method statically called by a remote machine to register an object reference.
      Parameters:
      ref - The remote reference to the object to be registered
      Throws:
      ServerNotActiveException
    • get

      public Hashtable get()
      This method is called by remote VMs, to request a copy of the remote object reference registry.
      Returns:
      A hashtable containing all the references, keyed by their server addresses
    • getDescription

      public String getDescription()
      Always a good idea; this method describes how to use the registry object, and what its features are. Not unlike these comments themselves.
      Returns:
      A string destribing this server object
    • main

      public static void main(String[] args)
      This method is used to start up the registry server. It will announce its startup on the hailing frequency, to allow linkage to other registries, before starting to listen on it, for new announcements.

      Note: to build this application, it will also require an RMI stub class for Remote. This means you must also run the following instruction:

      rmic -v1.2 gnu.cajo.invoke.Remote
      Parameters:
      args - If the server is behind a NAT router, the only argument should be the network address used outside the router. Otherwise provide nothing, and it will use the default local address.