Information Technology Reference
In-Depth Information
For example, the recovery routine:
recovery Error (RemoteException e) {
String[] s = new String[2];
s[0] = "host1" ;
s[1] = "host2" ;
setHosts(s);
}
resets the list of hosts to host1 and host2 . For user-defined recovery routines,
RemoteJ generates code to ensure that if calls to both host1 and host2 fail in
sequence, the system will not enter an infinite loop by continuously calling the re-
covery routine. In this instance we assume recovery is impossible and we terminate
the application.
An alternative user-defined implementation may be to obtain the list of avail-
able hosts from a user-defined routine such as the example below.
recovery Error (RemoteException e) {
String[] s = MyRecovery.getAvailableHosts();
setHosts(s);
}
In this case, the user-defined routine, MyRecovery , must be made available
at both compile time and runtime and the package name must be stipulated in
the DDL's import statement.
The Transfer object, illustrated in Figure 5.5, contains the system's current
state, which is generated and inserted by the RemoteJ compiler/generator at the
point when a remote method is about to be called. This contains the method to
be called, the method's parameters, the return object and the host that will be
called. As well as being available to user-defined recovery routines, the Transfer
object is also used for some protocol implementations. This is described in detail
in Section 5.5.2.
User-defined recovery routines have the ability to interact with generated
server code by the use of server plugins. Server plugin classes are classes that
extend Java's Thread class and are stipulated in the protocol's serverPlugin
option. The RemoteJ compiler/generator will instantiate the user-defined server
plugin at server startup and the plugin will be run in the server process in a
separate thread.
This option is intended to allow for the development of user-defined code
to interact with user-defined client-side recovery routines. For example, a server
plugin may announce its presence on the network in the event it receives a request
to do so. In the event of a failure, the user-defined recovery routine may switch
to an alternate server by broadcasting a message on the network and choosing the
first responding server. We evaluate this functionality in full in Section 6.4.2.
Search WWH ::




Custom Search