Package gnu.cajo.utils.extra
Class Registry
- java.lang.Object
-
- gnu.cajo.utils.extra.Registry
-
public final class Registry extends java.lang.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 java.util.Hashtable
entries
-
Constructor Summary
Constructors Constructor Description Registry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Hashtable
get()
This method is called by remote VMs, to request a copy of the remote object reference registry.java.lang.String
getDescription()
Always a good idea; this method describes how to use the registry object, and what its features are.static void
main(java.lang.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
post(RemoteInvoke ref)
This method statically called by a remote machine to register an object reference.
-
-
-
Method Detail
-
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 java.rmi.server.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:
java.rmi.server.ServerNotActiveException
-
get
public java.util.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 java.lang.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(java.lang.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.
-
-