Handles common method invocations.
186000
boolean handleCommonMethods(Object delegate, Method method, Object[] args) throws Throwable {
    if ("abort".equals(method.getName()) || "close".equals(method.getName())) {
      try {
        Reflection.invoke(delegate, method, args);
        return true;
      } finally {
        closed = true;
        afterClosure();
        interruptWaiters();
      }
    } else if ("addShutdownListener".equals(method.getName()) && args[0] != null)
      shutdownListeners.add((ShutdownListener) args[0]);
    else if ("removeShutdownListener".equals(method.getName()) && args[0] != null)
      shutdownListeners.remove((ShutdownListener) args[0]);
    return false;
  }
301002
private void commonConsoleLogHandlerUpdates() {
        if (consoleLogHandler != null) {
            consoleLogHandler.setBasicFormatter(formatter);
            consoleLogHandler.setConsoleLogLevel(consoleLogLevel.intValue());
            consoleLogHandler.setCopySystemStreams(copySystemStreams);
        }
    }
1179096
def handle_invocation(self, message):
        
        req_id = message.request_id
        reg_id = message.registration_id
        if reg_id in self._registered_calls:
            handler = self._registered_calls[reg_id][REGISTERED_CALL_CALLBACK]
            invoke = WampInvokeWrapper(self,handler,message)
            invoke.start()
        else:
            error_uri = self.get_full_uri('error.unknown.uri')
            self.send_message(ERROR(
                request_code = WAMP_INVOCATION,
                request_id = req_id,
                details = {},
                error =error_uri
            ))
374342
private void handleRpcInvocation(RpcInvocation rpcInvocation) {
		Method rpcMethod = null;

		try {
			String methodName = rpcInvocation.getMethodName();
			Class<?>[] parameterTypes = rpcInvocation.getParameterTypes();

			rpcMethod = lookupRpcMethod(methodName, parameterTypes);
		} catch (ClassNotFoundException e) {
			log.error("Could not load method arguments.", e);

			RpcConnectionException rpcException = new RpcConnectionException("Could not load method arguments.", e);
			getSender().tell(new Status.Failure(rpcException), getSelf());
		} catch (IOException e) {
			log.error("Could not deserialize rpc invocation message.", e);

			RpcConnectionException rpcException = new RpcConnectionException("Could not deserialize rpc invocation message.", e);
			getSender().tell(new Status.Failure(rpcException), getSelf());
		} catch (final NoSuchMethodException e) {
			log.error("Could not find rpc method for rpc invocation.", e);

			RpcConnectionException rpcException = new RpcConnectionException("Could not find rpc method for rpc invocation.", e);
			getSender().tell(new Status.Failure(rpcException), getSelf());
		}

		if (rpcMethod != null) {
			try {
				// this supports declaration of anonymous classes
				rpcMethod.setAccessible(true);

				if (rpcMethod.getReturnType().equals(Void.TYPE)) {
					// No return value to send back
					rpcMethod.invoke(rpcEndpoint, rpcInvocation.getArgs());
				}
				else {
					final Object result;
					try {
						result = rpcMethod.invoke(rpcEndpoint, rpcInvocation.getArgs());
					}
					catch (InvocationTargetException e) {
						log.debug("Reporting back error thrown in remote procedure {}", rpcMethod, e);

						// tell the sender about the failure
						getSender().tell(new Status.Failure(e.getTargetException()), getSelf());
						return;
					}

					final String methodName = rpcMethod.getName();

					if (result instanceof CompletableFuture) {
						final CompletableFuture<?> responseFuture = (CompletableFuture<?>) result;
						sendAsyncResponse(responseFuture, methodName);
					} else {
						sendSyncResponse(result, methodName);
					}
				}
			} catch (Throwable e) {
				log.error("Error while executing remote procedure call {}.", rpcMethod, e);
				// tell the sender about the failure
				getSender().tell(new Status.Failure(e), getSelf());
			}
		}
	}
474816
private static Object invokeOrDie(
      final Method method, final Object object, final Object... params) {
    try {
      return method.invoke(object, params);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(
        "Couldn't use Java reflection to implement protocol message " +
        "reflection.", e);
    } catch (InvocationTargetException e) {
      final Throwable cause = e.getCause();
      if (cause instanceof RuntimeException) {
        throw (RuntimeException) cause;
      } else if (cause instanceof Error) {
        throw (Error) cause;
      } else {
        throw new RuntimeException(
          "Unexpected exception thrown by generated accessor method.", cause);
      }
    }
  }
232549
private void invokeMethods(Event event) {
        try {
            List<MethodWrapper> methodWrappers = eventToMethodsMap.get(event.getType().name().toUpperCase());
            if (methodWrappers == null) return;

            methodWrappers = new ArrayList<>(methodWrappers);
            MethodWrapper matchedMethod =
                    getMethodWithMatchingPatternAndFilterUnmatchedMethods(getPatternFromEventType(event), methodWrappers);
            if (matchedMethod != null) {
                methodWrappers = new ArrayList<>();
                methodWrappers.add(matchedMethod);
            }

            for (MethodWrapper methodWrapper : methodWrappers) {
                Method method = methodWrapper.getMethod();
                if (Arrays.asList(method.getParameterTypes()).contains(Matcher.class)) {
                    method.invoke(this, event, methodWrapper.getMatcher());
                } else {
                    method.invoke(this, event);
                }
            }
        } catch (Exception e) {
            logger.error("Error invoking controller: ", e);
        }
    }
874356
@AroundInvoke
    public Object handle(InvocationContext ic) throws Exception {
        Method m = ic.getMethod();
        Object targetObject = ic.getTarget();
        Class<?> targetClass = targetObject == null ? m.getDeclaringClass()
                : targetObject.getClass();
        CatchHandler exceptionHandlerAnnotation = AnnotationUtils
                .findAnnotation(m, targetClass, CatchHandler.class);
        Exception unexpectedException = null;

        if (exceptionHandlerAnnotation == null) {
            throw new IllegalStateException(
                    "The interceptor annotation can not be determined!");
        }

        CatchHandling[] exceptionHandlingAnnotations = exceptionHandlerAnnotation
                .value();
        Class<? extends Throwable>[] unwrap = exceptionHandlerAnnotation
                .unwrap();

        try {
            return ic.proceed();
        } catch (Exception ex) {
            if (!contains(unwrap, InvocationTargetException.class)) {
                unwrap = Arrays.copyOf(unwrap, unwrap.length + 1);
                unwrap[unwrap.length - 1] = InvocationTargetException.class;
            }

            // Unwrap Exception if ex is instanceof InvocationTargetException
            Throwable t = ExceptionUtils.unwrap(ex,
                    InvocationTargetException.class);
            boolean exceptionHandled = false;
            boolean cleanupInvoked = false;

            if (exceptionHandlingAnnotations.length > 0) {
                for (CatchHandling handling : exceptionHandlingAnnotations) {
                    if (handling.exception().isInstance(t)) {
                        try {
                            handleThrowable(t);
                            exceptionHandled = true;
                        } catch (Exception unexpected) {
                            unexpectedException = unexpected;
                        }

                        // Only invoke cleanup declared at handling level
                        if (!handling.cleanup().equals(Object.class)) {
                            cleanupInvoked = invokeCleanups(targetClass, targetObject,
                                    handling.cleanup(), t);
                        }

                        break;
                    }
                }
            }

            // Handle the default exception type if no handlings are
            // declared or the handling did not handle the exception
            if (!exceptionHandled) {
                if (exceptionHandlerAnnotation.exception().isInstance(t)) {
                    try {
                        handleThrowable(t);
                        exceptionHandled = true;
                    } catch (Exception unexpected) {
                        unexpectedException = unexpected;
                    }

                    if (!exceptionHandlerAnnotation.cleanup().equals(
                            Object.class) && !cleanupInvoked) {
                        if (!cleanupInvoked) {
                            invokeCleanups(targetClass, targetObject,
                                    exceptionHandlerAnnotation.cleanup(), t);
                        }
                    }
                }
            }

            if (!exceptionHandled) {
                if (t instanceof Exception) {
                    unexpectedException = (Exception) t;
                } else {
                    unexpectedException = new Exception(t);
                }
            }
        }

        if (unexpectedException != null) {
            throw unexpectedException;
        }

        return null;
    }
348858
protected void preInvoke(Method m, Object [] args, String [] interceptorNames)
        throws InterceptorPivotException
    {
        //
        // If the implementation expects single threaded behavior and our container does
        // not guarantee it, then enforce it locally here
        //
        if (_invokeLock != null)
        {
            try { _invokeLock.acquire(); } catch (InterruptedException ie) { }
        }

        //
        // Process interceptors
        //
        if ( interceptorNames != null )
        {
            for ( String n : interceptorNames )
            {
                Interceptor i = ensureInterceptor( n );
                try
                {
                    i.preInvoke( this, m, args );
                }
                catch (InterceptorPivotException ipe)
                {
                    ipe.setInterceptorName(n);
                    throw ipe;
                }
            }
        }

        Vector<InvokeListener> invokeListeners = getInvokeListeners();
        if (invokeListeners.size() > 0)
        {
            for (InvokeListener listener : invokeListeners)
                listener.preInvoke(m, args);
        }
    }
138506
private static ReflectionException handleException(String methodName, InvocationTargetException e) {
        LOGGER.error("Couldn't invoke method " + methodName, e);
        return new ReflectionException(e);
    }
462187
def _handle_request(self, msg_id, method, params):
        """"""
        try:
            handler = self._dispatcher[method]
        except KeyError:
            raise JsonRpcMethodNotFound.of(method)

        handler_result = handler(params)

        if callable(handler_result):
            log.debug("Executing async request handler %s", handler_result)
            request_future = self._executor_service.submit(handler_result)
            self._client_request_futures[msg_id] = request_future
            request_future.add_done_callback(self._request_callback(msg_id))
        else:
            log.debug("Got result from synchronous request handler: %s", handler_result)
            self._consumer({
                'jsonrpc': JSONRPC_VERSION,
                'id': msg_id,
                'result': handler_result
            })
1043282
def _dispatch(self, method, params):
        """"""
        self._count += 1

        func = getattr(self, method)
        try:
            return func(*params)
        except Exception as e:
            traceback.print_exc()
            raise e
894861
Callable<?> invokeMethod(MethodHandler methodHandler, Object[] arguments) {
    return () -> {
      try {
        return methodHandler.invoke(arguments);
      } catch (Throwable th) {
        if (th instanceof FeignException) {
          throw (FeignException) th;
        }
        throw new RuntimeException(th);
      }
    };
  }
680186
void handleOK() {
        String[] selected = this.selected.paths.toArray(new String[0]);
        listener.selectedImages(selected);
    }
654862
private void callHandleMethod(Method method, Object instance, ApiZone apiZone,
            Object userAgent) {
        ReflectMethodUtil.invokeHandleMethod(method, instance, context, apiZone, userAgent);
    }
165782
private void processMethodCall() {
        if ("invoke".equals(getNameConstantOperand()) && "java/lang/reflect/Method".equals(getClassConstantOperand())) {
            return;
        }
        String sig = getSigConstantOperand();
        List<String> args = SignatureUtils.getParameterSignatures(sig);
        if (stack.getStackDepth() >= args.size()) {
            for (int i = 0; i < args.size(); i++) {
                String argSig = args.get(i);
                if (argSig.startsWith(Values.SIG_ARRAY_PREFIX)) {
                    OpcodeStack.Item itm = stack.getStackItem(args.size() - i - 1);
                    int arrayReg = itm.getRegisterNumber();
                    WrapperInfo wi = wrappers.get(Integer.valueOf(arrayReg));
                    if (wi != null) {
                        wi.wasArg = true;
                    }
                }
            }
        }
    }
699888
protected void invokeExecuteMethod(Method method, Object listener, Object userAgent) {
	    ReflectMethodUtil.invokeExecuteMethod(
                method, listener, context, userAgent);
	}
1328039
public Object dispatch(Invocation invocation) throws Throwable {
        for (Expectation expectation : expectations) {
            if (expectation.matches(invocation)) {
                return expectation.invoke(invocation);
            }
        }

        throw ExpectationError.unexpected("unexpected invocation", invocation);
    }