public Object execute ( Method method , Object targetObj , Object [ ] p_args ) throws Throwable { try { if ( ( method == null ) || ( targetObj == null ) ) Debug . logError ( "[JdonFramework] no method or target, please check your configure" , module ) ; if ( p_args == null ) p_args = new Object [ 0 ] ; Debug . logVerbose ( "[JdonFramework] method invoke: " + targetObj . getClass ( ) . getName ( ) + " method=" + method . getName ( ) , module ) ; Object result = method . invoke ( targetObj , p_args ) ; Debug . logVerbose ( "[JdonFramework] method invoke successfully " , module ) ; return result ; } catch ( IllegalArgumentException iex ) { String errorInfo = "Errors happened in your method:[" + targetObj . getClass ( ) . getName ( ) + "." + method . getName ( ) + "]" ; Debug . logError ( errorInfo , module ) ; errorInfo = "[JdonFramework] method invoke IllegalArgumentException: " + iex + " method argument type :[" + method . getParameterTypes ( ) + "], but method arguments value p_args type:" + p_args . getClass ( ) . getName ( ) ; Debug . logError ( errorInfo , module ) ; throw new Throwable ( errorInfo , iex ) ; } catch ( InvocationTargetException ex ) { Debug . logError ( ex ) ; String errorInfo = "Errors happened in your method:[" + targetObj . getClass ( ) . getName ( ) + "." + method . getName ( ) + "]" ; Debug . logError ( errorInfo , module ) ; throw new Throwable ( errorInfo ) ; } catch ( IllegalAccessException ex ) { String errorInfo = "Errors happened in your method:[" + targetObj . getClass ( ) . getName ( ) + "." + method . getName ( ) + "]" ; Debug . logError ( errorInfo , module ) ; Debug . logError ( "[JdonFramework] method invoke IllegalAccessException: " + ex , module ) ; throw new Throwable ( "access method:" + method + " " + ex , ex ) ; } catch ( Exception ex ) { String errorInfo = "Errors happened in your method:[" + targetObj . getClass ( ) . getName ( ) + "." + method . getName ( ) + "]" ; Debug . logError ( errorInfo , module ) ; Debug . logError ( "[JdonFramework] method invoke error: " + ex , module ) ; throw new Throwable ( " method invoke error: " + ex ) ; } }
the service execute by method reflection