Logo of the Java RMI Plug-in for Eclipse

RMI Plug-in for Eclipse
version 2.0

The Registry Inspector


The RMI Registry Inspector can display the contents of an RMI registry, examine their class structure and even invoke their remote methods directly from within Eclipse.

Basics

The RMI Registry Inspector does more than just telling you what is in the registry. But, first things first, here is a screenshot of the basic registry inspector interface:

The main view provides some basic information:

  • The hostname and port number of the registry.
  • The number of elements in the registry. For convenience this information is also displayed on the view's title and is updated constantly even when the view is not in focus.
  • The objects names that were registered.
  • For each object (or its stub), its complete class hierarchy is displayed. Double clicking on a class name will open the corresponding Java source (or .class) file.
  • For each object, the Registry Inspector displays all the remote methods (and some other useful methods) that are defined for the object.
  • The status line displays additional information about the object - it's endpoint (the host and port through which it is available) and the Object's ID. Both are internal values that as a developer you can't use directly, but they are very useful during debugging.
  • The status line also displays the codebase associated with the object. It can be useful to debug possible codebase problems (the RMI Spy will help you there as well)

Some of the information that can be displayed by the Registry Inspector requires to enable the "Retrieve Details" option. See the help item below for more information.

Basic Registry Inspector Commands

Unbind

Removes the selected names (and their objects) from the registry.

Unbind All and GC

Remove all objects from the registry and perform a full garbage collection in the Eclipse VM. Running a GC will make sure that remote classes that were loaded by Eclipse for class hierarchy inspection will be unloaded. If the classes are not unloaded and you change their class definitions (add methods ,etc) the Registry Inspector may not be able to display the correct information. Note: If you perform "Clean Registry" from the RMI toolbar menu, it won't perform a GC of the Eclipse VM. In Eclipse 3.2 you can manually call the garbage collector by using the "Heap Status" indicator.

Retrieve Details

Enable or disable the retrieval of object details. Retrieving object details will load the remote objects into the Eclipse VM. A warning will be presented about the possible security issues that are involved in loading remote objects, but in 99.99% of the cases it's perfectly safe to "OK" it.

Connect to...

Inspects another registry (different host/port).


Invoking Remote Methods

Sometime you wish to experiment with the remote objects, especially if you weren't the one who implemented them. What can be easier than write a piece of code that fetches them from the registry and calls the remote methods? Of course, doing it without writing any code. The Registry Inspector of the RMI Plug-in for Eclipse will let you invoke any remote method on a registered object, with the arguments that you provide. Suppose we've added the following method to our RemotePrinter interface:

public int submitJob(URL url, String header, int priority) 
     throws RemoteException;

When we try to invoke the new submitJob() method, the arguments dialog box is presented:

The following table describes how the arguments are supplied to the remote method:

Argument Type

Possible argument value

primitive numerics (int, byte, float)

Enter the numeric value.

char

Enter the character symbol (e.g, 'a' without the quotes)

boolean

Either "true" or "false" (no quotes)

primitive wrappers (Integer, Double)

Same as for primitives or check the "null" box to supply a null value.

String

Enter the string, check "Default ctor" to send an empty string, or check the "null" box to send a null value.

Any Java class with a constructor from "String" (e.g., java.net.URL).

Enter the sting that will be passed to the constructor.

Any class with a default constructor

In addition to other options you can check the "Default ctor" box to send the default instance of the class.

An interface/abstract class

It's impossible to create instances of such classes, so only "null" values are possible.

Swing/AWT class

Only the "null" value can be sent. This is by design.

User defined classes

Such classes can't be loaded by Eclipse. Therefore, only "null" value can be sent.

If an exceptions is thrown during a construction of the arguments you'll be presented an appropriate error dialog. If an exception is thrown by the remote method you'll be presented another dialog with the error description.


© 2002-18 Genady Beryozkin, rmi-info@genady.net. Read our Privacy policy. Hosted on RimuHosting. Visit Javalobby.