| CONTENTS | PREV | NEXT | Java Remote Method Invocation |
RMIFailureHandler Interface
Thejava.rmi.server.RMIFailureHandlerinterface provides a method for specifying how the RMI runtime should respond when server socket creation fails (except during object export).
package java.rmi.server;
public interface RMIFailureHandler {
public boolean failure(Exception ex);
}
Thefailuremethod is invoked with the exception that prevented the RMI runtime from creating ajava.net.ServerSocket. The method returnstrueif the runtime should attempt to retry andfalseotherwise.Before this method can be invoked, a failure handler needs to be registered via the
RMISocketFactory.setFailureHandlercall. If the failure handler is not set, the RMI runtime attempts to re-create theServerSocketafter waiting for a short period of time.Note that the
RMIFailureHandleris not called whenServerSocketcreation fails upon initial export of the object. TheRMIFailureHandlerwill be called when there is an attempt to create aServerSocketafter a failed accept on thatServerSocket.