Hello all, I'm new here.

I currently writing project in java for graduation.
It's trivia game. some clients connect to server and play with each other.
The program use RMIfor communication, and also client and server extends Remote to allow calling method from remote.

I thinking how it will be more appropriate to call method in the server to the client.
Each time the server try to call the client, and get RemoteException I assume that the client is no longer connect, and therefore call private method to remote his information from the server.
that way it's create many returning code: each time it's:
try{
methodName();
}
catch(RemoteException e){
removeClient(i);
}

so I thought to create private method - callRemoteMethodInClient - and each time the server want to call the client he call this method with the client method name.
and in the private method a runs if-else-if to determine witch method to call.

in the second way the code is shorter, and maybe little cleaner. but I don't sure if it's correct from the way of good programming.

appreciate for advices
Liron