Java Reference
In-Depth Information
UnicastRemoteObject
java.rmi.Remote
DActivity
DProcess
MyServiceInterf
MyServerInterf
doMyService()
startMyService
MyService
MyServer
run()
doMyService()
startMyService()
MyClient
Figure 19.4 Classes depicted with thick borders are specializations of the
framework classes
interface MyServerInterface . Both interfaces extend interface java.rmi.
Remote . When a remote client invokes this method, an instance of MyService
is created within MyServer and is registered as a remote object with the
Naming.bind() mechanism of RMI. The URL of MyService object is returned to
the client that uses it to get a reference to the remote service.
19.4.3
Implementation
Class DActivity is the superclass of every remote control service. It imple-
ments methods to set and get the URL of the service, to start and stop it and
to execute it as an independent thread of control. Every concrete service
should implement three basic methods: init() is invoked when the service is
created, step() is invoked repeatedly while the service is running, quit() is
invoked before the service terminates its execution.
package mmi;
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
public abstract class DActivity
 
Search WWH ::




Custom Search