/** Do some validation of the return value */ protected Object validateReturnValue(Invocation mi, Object retValue) { if (mi.getType() == InvocationType.REMOTE) { if (retValue instanceof TimerHandle) throw new IllegalArgumentException("Cannot return TimerHandle from remote interface"); } return retValue; }
/** Do some validation of the incoming parameters */ protected void validateArguments(Invocation mi) { if (mi.getType() == InvocationType.REMOTE) { Object[] params = mi.getArguments(); for (int i = 0; i < params.length; i++) { Object obj = params[i]; if (obj instanceof TimerHandle) throw new IllegalArgumentException("Cannot pass TimerHandle through remote interface"); } } }