Java Reference
In-Depth Information
Q Which method is better, RMI or sockets?
A Each approach has its strengths. Sockets are useful for sending large amounts of data
(with or without a protocol) without a lot of overhead. With RMI it is much easier to
implement a multithreaded server, since RMI handles the threading aspect for you.
The remote object also behaves as if it is a local object complete with a protocol or set
of public methods, whereas sockets require that you implement a protocol. It is really
up to you, but both approaches should work fine as long as you understand the key
technical issues pertaining to the protocol.
Q Is a security manager, or some sort of authentication, required?
A This depends largely on the details of your exam. Read the instructions very carefully!
Each test is different. In this chapter, we briefly discussed a number of security issues
such as policy files, dynamic class loading, HTTP tunneling, firewalls, and security
managers. However, in our implementation, we do include a security manager and do
not make use of policy files.
Q Do I need to include the skeletons in my J2SE 5.0 implementation of RMI?
A Yes. Skeletons are only required for those Java versions prior to 1.2 (i.e., version 1.1). By
default, skeletons are generated when rmic is run on your remote object implementa-
tions, but you can control this feature by using the -keep v1.2 option of rmic . However,
at the time of this writing, the certification project still requires that stubs be included
with your submission and that you do not rely on the dynamic stub generation tech-
nique in the Tiger version (i.e., J2SE 5.0).
Q Am I required to start the RMI registry manually?
A No. The registry must be started programmatically. Again, read the instructions on
your exam. But most likely, you will be required to start the registry as we did in the
RegDVDDatabase class. The class has a register method that binds the remote object
implementation class in the RMI naming service and uses the LocateRegistry.
register method. When running this across a network, as we will in Chapter 8, you
should call the getRemote method in Connector from a main method.
Search WWH ::




Custom Search