Пример #1
0
 /**
  * @param call
  * @param implementor
  */
 private RemoteMethodCallResults invokeSingle(
     final RemoteMethodCall call, final Object implementor, final INode messageOriginator) {
   call.resolve(m_remoteClass);
   Method method;
   try {
     method = implementor.getClass().getMethod(call.getMethodName(), call.getArgTypes());
     method.setAccessible(true);
   } catch (final SecurityException | NoSuchMethodException e) {
     ClientLogger.logQuietly(e);
     throw new IllegalStateException(e.getMessage());
   }
   MessageContext.setSenderNodeForThread(messageOriginator);
   try {
     final Object methodRVal = method.invoke(implementor, call.getArgs());
     return new RemoteMethodCallResults(methodRVal);
   } catch (final InvocationTargetException e) {
     return new RemoteMethodCallResults(e.getTargetException());
   } catch (final IllegalAccessException e) {
     ClientLogger.logQuietly("error in call:" + call, e);
     return new RemoteMethodCallResults(e);
   } catch (final IllegalArgumentException e) {
     ClientLogger.logQuietly("error in call:" + call, e);
     return new RemoteMethodCallResults(e);
   } finally {
     MessageContext.setSenderNodeForThread(null);
   }
 }
 private void assertSentFromServer() {
   if (!MessageContext.getSender().equals(m_messenger.getServerNode()))
     throw new IllegalStateException("Invalid sender");
 }