protected Serializable perform(Channel channel) throws Throwable { Object o = channel.getExportedObject(oid); if(o==null) throw new IllegalStateException("Unable to call "+methodName+". Invalid object ID "+oid); try { Method m = choose(o); if(m==null) throw new IllegalStateException("Unable to call "+methodName+". No matching method found on "+o.getClass()); m.setAccessible(true); // in case the class is not public return (Serializable) m.invoke(o,arguments); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
protected Serializable perform(Channel channel) throws Throwable { Object o = channel.getExportedObject(oid); if(o==null) throw new IllegalStateException("Unable to call "+methodName+". Invalid object ID "+oid); try { Method m = choose(o); if(m==null) throw new IllegalStateException("Unable to call "+methodName+". No matching method found on "+o.getClass()); m.setAccessible(true); // in case the class is not public return (Serializable) m.invoke(o,arguments); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
protected Serializable perform(Channel channel) throws Throwable { Object o = channel.getExportedObject(oid); if(o==null) throw new IllegalStateException("Unable to call "+methodName+". Invalid object ID "+oid); try { Method m = choose(o); if(m==null) throw new IllegalStateException("Unable to call "+methodName+". No matching method found on "+o.getClass()); m.setAccessible(true); // in case the class is not public return (Serializable) m.invoke(o,arguments); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
protected Serializable perform(@Nonnull Channel channel) throws Throwable { Object o = channel.getExportedObject(oid); Class[] clazz = channel.getExportedTypes(oid); try { Method m = choose(clazz); if(m==null) throw new IllegalStateException("Unable to call " + methodName + ". No matching method found in " + Arrays.toString(clazz) + " for " + o); m.setAccessible(true); // in case the class is not public Object r; try { r = m.invoke(o, arguments); } catch (IllegalArgumentException x) { throw new RemotingSystemException("failed to invoke " + m + " on " + o + Arrays.toString(arguments), x); } if (r==null || r instanceof Serializable) return (Serializable) r; else throw new RemotingSystemException(new ClassCastException(r.getClass()+" is returned from "+m+" on "+o.getClass()+" but it's not serializable")); } catch (InvocationTargetException e) { throw e.getTargetException(); } }