예제 #1
0
 /// <summary>
 /// Spawn a new instance.
 /// </summary>
 /// <param name="fullName"></param>
 /// <returns></returns>
 public INode CreateInstance(NodeInfo info)
 {
     var handler = GetHandlerForRMITypeName(info.RMITypeName);
     if (handler == null){ log.Debug("Cannot find an instance for "+info.RMITypeName);return null;}
     info.RMIResolvedType = handler.ComponentModel.Implementation;
     log.Debug("Launching a new instance: [RMI] "+info.RMITypeName+" [IMPL] "+handler.ComponentModel.Implementation.FullName);
     return (INode)handler.Resolve(CreationContext.CreateEmpty());
 }
예제 #2
0
 /// <summary>
 /// Launch a new node based on info.
 /// </summary>
 /// <param name="info"></param>
 public void LaunchNode(NodeInfo info)
 {
     var instance = NodeManager.Instance.CreateInstance(info);
     instance.Initialize(new MatrixPortal(HostClient.Instance, info.Id));
     Nodes.Add(info, instance);
 }
예제 #3
0
 public void ShutdownNode(NodeInfo nodeInfo)
 {
     var nodeInstance = Nodes.Keys.FirstOrDefault(e => e.Id == nodeInfo.Id);
     if (nodeInstance == null) return;
     var instance = Nodes[nodeInstance];
     instance.Shutdown();
     Nodes.Remove(nodeInstance);
 }
예제 #4
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()));
 }