public RMIResponse invoke(MarshalledInvocation mi) throws Exception { mi.setMethodMap(invokerMap); Method method = mi.getMethod(); RMIResponse rsp = new RMIResponse(); rsp.response = method.invoke(handler, mi.getArguments()); return rsp; }
MarshalledInvocation invocationCopy = new MarshalledInvocation(invocation); invocationCopy.setMethod(null); invocationCopy.setMethodHash(MarshalledInvocation.calculateHash(invocation.getMethod())); invocationCopy.setMarshalledArguments(value); invocationCopy.setArguments(null); invocationCopy.setInvocationContext(copyContext);
Long hash = new Long(MarshalledInvocation.calculateHash(method)); marshalledInvocationMapping.put(hash, method); Map m = MarshalledInvocation.methodToHashesMap(Connection.class); displayHashes(m); marshalledInvocationMapping.putAll(m); m = MarshalledInvocation.methodToHashesMap(Statement.class); displayHashes(m); marshalledInvocationMapping.putAll(m); m = MarshalledInvocation.methodToHashesMap(CallableStatement.class); displayHashes(m); marshalledInvocationMapping.putAll(m); m = MarshalledInvocation.methodToHashesMap(PreparedStatement.class); displayHashes(m); marshalledInvocationMapping.putAll(m); m = MarshalledInvocation.methodToHashesMap(ResultSet.class); displayHashes(m); marshalledInvocationMapping.putAll(m); m = MarshalledInvocation.methodToHashesMap(DatabaseMetaData.class); displayHashes(m); marshalledInvocationMapping.putAll(m);
public Object invokeRemote(Object proxy, Method method, Object[] args) throws Throwable { MarshalledInvocation mi = new MarshalledInvocation(null, method, args, null, null, null); mi.setObjectName(""); RMIResponse rsp = this.rmiServer.invoke(mi); return rsp.response; }
public Object invoke(Invocation mi) throws Exception { final boolean remoteInvocation = mi instanceof MarshalledInvocation; if(remoteInvocation) { ((MarshalledInvocation)mi).setMethodMap(methodMap); } final Object result; if(invokeTargetMethod) { String signature[] = (String[])signatureMap.get(mi.getMethod()); result = server.invoke(targetName, mi.getMethod().getName(), mi.getArguments(), signature); } else { result = server.invoke(targetName, "invoke", new Object[]{mi}, Invocation.INVOKE_SIGNATURE); } return result; }
private void calculateHashes(){ Class[] cfInterfaces = cf.getClass().getInterfaces(); for (int i = 0; i < cfInterfaces.length; i++) { Class clazz = cfInterfaces[i]; Method[] methods = clazz.getMethods(); for (int j = 0; j < methods.length; j++) { Method m = methods[j]; Long hash = new Long(MarshalledInvocation.calculateHash(m)); marshalledInvocationMapping.put(hash, m); } } }
getAsIsPayload().put(InvocationKey.TYPE, invocationType); if(methodHash == 0) methodHash = calculateHash(this.method); out.writeObject(createMarshalledValue(serializationType,this.args)); value = createMarshalledValue(serializationType,value);
MarshalledInvocation marshInv = new MarshalledInvocation(inv); marshInv.setTransactionPropagationContext(getTransactionPropagationContext());
private void calculateHashes(Class clazz){ Class[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { Class target = interfaces[i]; Map m = MarshalledInvocation.methodToHashesMap(target); marshalledInvocationMapping.putAll(m); } }
MarshalledInvocation mi = new MarshalledInvocation(invocation); mi.setValue("CLUSTER_VIEW_ID", new Long(familyClusterInfo.getCurrentViewId())); String target = (String) getRemoteTarget(invocation); boolean failoverAuthorized = true;
/** This method builds a MarshalledInvocation from the invocation passed in and then does a post to the target URL. */ public Object invoke(Invocation invocation) throws Exception { // We are going to go through a Remote invocation, switch to a Marshalled Invocation MarshalledInvocation mi = new MarshalledInvocation(invocation); if( externalURL == null ) externalURL = Util.resolveURL(externalURLValue); try { Object value = Util.invoke(externalURL, mi); return value; } catch (InvocationException e) { // Unwrap the invoker servlet InvocationExceptions Throwable t = e.getTargetException(); if( t instanceof Exception ) throw (Exception) t; else if (t instanceof Error) throw (Error) t; throw new InvocationTargetException(t); } catch (IOException e) { throw new ServerException("IOE", e); } }
public Object filter(MarshalledInvocation input, Object result) throws Throwable { if ("getMBeanInfo".equals(input.getMethod().getName()) && (result instanceof ModelMBeanInfo)) { MBeanInfo info = (MBeanInfo)result; result = new MBeanInfo( info.getClassName(), info.getDescription(), deepCopy(info.getAttributes()), // Strip the Descriptors info.getConstructors(), info.getOperations(), info.getNotifications()); } return result; }
mi.setMethodMap(this.marshalledInvocationMapping);
protected void setupMarshalledInvocationMapping() throws Exception { // Create method mappings for container invoker if (homeInterface != null) { Method [] m = homeInterface.getMethods(); for (int i = 0 ; i<m.length ; i++) { marshalledInvocationMapping.put( new Long(MarshalledInvocation.calculateHash(m[i])), m[i]); } } if (remoteInterface != null) { Method [] m = remoteInterface.getMethods(); for (int j = 0 ; j<m.length ; j++) { marshalledInvocationMapping.put( new Long(MarshalledInvocation.calculateHash(m[j])), m[j]); } } // Get the getEJBObjectMethod Method getEJBObjectMethod = Class.forName("javax.ejb.Handle").getMethod("getEJBObject", new Class[0]); // Hash it marshalledInvocationMapping.put(new Long(MarshalledInvocation.calculateHash(getEJBObjectMethod)),getEJBObjectMethod); }
MarshalledInvocation mi = new MarshalledInvocation(null, method, args, null, null, null); mi.setObjectName (""); //FIXME: Fake value! Bill's optimisations regarding MI make the hypothesis
MarshalledInvocation marshInv = new MarshalledInvocation(inv); marshInv.setTransactionPropagationContext(getTransactionPropagationContext());
public RMIServerImpl(String replicantName, Class intf, Object handler) throws Exception { this.handler = handler; this.log = Logger.getLogger(this.getClass()); this.intf = intf; this.key = "/" + replicantName; // Obtain the hashes for the supported handler interfaces Class[] ifaces = handler.getClass().getInterfaces(); for (int i = 0; i < ifaces.length; i++) { Map tmp = MarshalledInvocation.methodToHashesMap(ifaces[i]); invokerMap.putAll(tmp); } this.rmistub = (RemoteStub) UnicastRemoteObject.exportObject(this, 0, null, null);// casting is necessary because interface has // changed in JDK>=1.2 RMIServer.rmiServers.put(key, this); }
MarshalledInvocation mi = new MarshalledInvocation(invocation); MarshalledValue copy = new MarshalledValue(mi); Invocation invocationCopy = (Invocation) copy.get();
public HARMIResponse invoke(long clientViewId, MarshalledInvocation mi) throws Exception { mi.setMethodMap(invokerMap); Method method = mi.getMethod(); try { HARMIResponse rsp = new HARMIResponse(); if (clientViewId != target.getCurrentViewId()) { rsp.newReplicants = new ArrayList<Object>(target.getReplicantList()); rsp.currentViewId = target.getCurrentViewId(); } rsp.response = method.invoke(handler, mi.getArguments()); return rsp; } catch (IllegalAccessException iae) { throw iae; } catch (IllegalArgumentException iae) { throw iae; } catch (java.lang.reflect.InvocationTargetException ite) { throw (Exception)ite.getTargetException(); } }
mi.setMethodMap(marshalledInvocationMapping);