use of rpc.turbo.remote.RemoteInterface in project turbo-rpc by hank-whu.
the class TurboClient method setFailover.
/**
* 设置失败回退方法
*
* @param clazz
* @param failover
*/
public <T> void setFailover(Class<T> clazz, Object failover) {
Objects.requireNonNull(clazz, "clazz");
T service = remoteServiceFactory.getService(clazz);
if (service == null) {
throw new RemoteException("not register this service, " + clazz.getName());
}
try {
App app = ((RemoteInterface) service).getApp();
remoteServiceFactory.setFailover(app, clazz, service, failover);
} catch (Exception e) {
throw new RemoteException(e);
}
}
Aggregations