Java Reference
In-Depth Information
Many environments can use the basic infrastructure just described. A
compute farm that uses a large number of computers to render an-
imation can use such a system to feed those computers images to be
rendered, sound computations, and other tasks. This simple example
needs some hardening to be used in other situations, especially when
Task objects could not be trusted to be friendly. All you need is a Java
virtual machine at both ends of the network.
UnicastRemoteObject references are for remote services that are started
by the user or system. You can use java.rmi.activation.Activatable for
references to remote objects that you want to be started automatically
when they are first needed.
Because of the dangers inherent in running downloaded code, RMI re-
quires that a security manager be installed. The RMISecurityManager class
is a very conservative security manager that you can install to prevent
unauthorized access to your system, or you can provide your own se-
curity manager.
Your server class may not be able to extend an RMI server class because
your class must extend a different class. For example, an applet class
must extend Applet and so cannot extend UnicastRemoteObject . You can
create servers that do not extend UnicastRemoteObject by having your
class's constructor invoke a static method:
public class SnazzyApplet extends Applet
implements SnazzyRemote
{
public SnazzyApplet() throws RemoteException {
UnicastRemoteObject.exportObject(this);
}
// ... implement SnazzyRemote and Applet methods ...
}
Classes are downloaded from client to server (or server to client) only
if they are needed. Classes will often be known on both sides. For ex-
ample, BigDecimal is part of the core, so both the client and the serv-
 
Search WWH ::




Custom Search