Information Technology Reference
In-Depth Information
Client
Calls:
Response:
4
6
1: Call getDate()
2. Call failed, call nextServer
3. Connect to Server 2
4. Call failed, call nextServer
5. Connect to Server 3
6. Call failed, call nextServer
7. Unrecoverable error if no
servers have responded otherwise
connect to Server 1.
3
5
7
1
2
Server 1
Server 2
Server 3
Figure 6.13. Automatic recovery capability. The nextServer
statement provides a simple clustering capability where a client
request is redirected to an alternate server in the event of a dis-
tribution or communication error. If no servers can be contacted
the application will be automatically terminated.
public class ClockDate {
public Date getDate() {
return new Date();
}
public static void main(String[] args) throws InterruptedException {
ClockDate cd = new ClockDate();
while (true){
System.out.println( "Current Date: " + cd.getDate());
Thread.sleep(2000);
}
}
}
Figure 6.14.
ClockDate class.
We began the evaluation by running the server-side application on three
machines in a cluster and starting the client, which connected to the first server,
localhost .
We aborted the first server, which caused the client to automatically recon-
nect to the next server, bookworm . We then restarted the first server and ter-
minated the second thereby causing the client to automatically reconnect to the
third server, bookpro .
 
Search WWH ::




Custom Search