The RMI module generates implementation
classes that are complete except for the business logic. In addition, the generated
implementation classes contain code that will register an instance of the class
with an RMI registry running at //localhost:1099/
. If you want to
register your server in another registry you need to modify this code.
If your business logic is complex, consider implementing some of it in private methods that are not declared in the remote interface, or even in additional classes.
Hello
, the RMI module generates an implementation
class named HelloImpl
, and the default binding behavior is determined
by the following code:
HelloImpl obj = new HelloImpl ();
registerToRegistry("HelloImpl", obj, true);
To change the binding name, change the value of the first parameter. For example:
HelloImpl obj = new HelloImpl ();
registerToRegistry("HelloServer", obj, true);
The following code relies on this default behavior:
HelloImpl obj = new HelloImpl();
registerToRegistry("HelloImpl", obj, true);
Since
the first parameter, name
, does not specify host and port, these
values default to //localhost:1099/
in the rebind
call.
If you want to register your server with some other registry, do the following:
registerToRegistry
arguments.Compile
from the contextual menu. Doing so also compiles the
remote interface and generates the stub and skeleton files.