示例#1
0
        public void ProcessRMI(NodeRMI rmi)
        {
            var nodeInstance = Nodes.Keys.FirstOrDefault(e => e.Id == rmi.NodeID);
            if (nodeInstance == null) return;
            var instance = Nodes[nodeInstance];
            //Find the method
            var method = nodeInstance.RMIResolvedType.GetMethod(rmi.MethodName);
            var result = method.Invoke(instance, rmi.DeserializeArguments());
            if (method.ReturnType == typeof(void)) return;

            rmi.SerializeReturnValue(result);
            HostClient.Instance.ProcessRMIResponse(rmi);
        }
示例#2
0
 /// <summary>
 /// Route a RMI request to the host with the target node
 /// </summary>
 /// <param name="rmi"></param>
 /// <param name="destoNode"> </param>
 public void RouteRMIRequest(NodeRMI rmi, NodeInfo destoNode)
 {
     if(destoNode.HostID.Length == 1)
     {
         rmi.SerializeReturnValue(destoNode.RMIResolvedType.GetMethod(rmi.MethodName).Invoke(controller, rmi.DeserializeArguments()));
         RouteRMIResponse(rmi);
         return;
     }
     var destoHost = HostCache.FindHost(destoNode.HostID);
     SendTo(destoHost.Info, destoHost.BuildMessage(MessageIdentifier.RMIInvoke, rmi.Serialize()));
 }