Esempio n. 1
0
        /// <summary>
        /// Internal execute function to be called asynchronously.
        /// </summary>
        /// <param id="state">The server state object associated with the execution.</param>
        private static void execute(ServerState state)
        {
            Interlocked.Increment(ref runningJobs);
            //get the execution context
            SerializationEngine serializer = new SerializationEngine();

            Transfers.ExecutionContext context = (Transfers.ExecutionContext)serializer.Deserialize(state.GetDataArray());
            byte[] res = DomainManager.ExecuteIncoming(context);
            Transfers.ExecutionResult result = new Transfers.ExecutionResult(res, context.ContextID, context.DomainKey, ClusterManager.NodeID);
            state.Write(MessageType.EXECUTION_COMPLETE, serializer.Serialize(result));
            Interlocked.Decrement(ref runningJobs);
        }
Esempio n. 2
0
 /// <summary>
 /// Deploys an execution into the cluster.
 /// </summary>
 /// <param name="assemblyName">The full name of the assembly.</param>
 /// <param name="typeName">The full name of the type.</param>
 /// <param name="methodName">The full name of the method.</param>
 /// <param name="param">the serialized parameter object.</param>
 /// <param name="contextid">The context id of this execution.</param>
 /// <param name="domainKey">The domain Key of this domain.</param>
 public void Execute(string assemblyName, string typeName, string methodName, byte[] param, string contextid, string domainKey)
 {
     ExecutionContext context = new ExecutionContext(assemblyName, typeName, methodName, param, contextid, domainKey);
     Nodes.BestNode(domainKey).Execute(context);
 }
Esempio n. 3
0
 /// <summary>
 /// Trigger an execution on this node.
 /// </summary>
 /// <param id="executionContext">The execution context of the job.</param>
 public bool Execute(ExecutionContext executionContext)
 {
     RunningJobs++;
     //first be sure that this node has the appropriate assembly loaded
     if (!HasAssembly(executionContext.AssemblyName)) {
         //get the assembly
         byte[] assembly = DomainManager.GetAssemblyStream(executionContext.AssemblyName);
         deliverAssembly(executionContext.AssemblyName, assembly, executionContext.DomainKey);
     }
     assemblyLoadReset.WaitOne();
     //since we know that the other machine has the assembly loaded we can
     //serialize the execution context and transport
     SerializationEngine serializer = new SerializationEngine ();
     client.Write(MessageType.EXECUTION_BEGIN, serializer.Serialize(executionContext));
     return true;
 }
Esempio n. 4
0
 /// <summary>
 /// Execute an incoming job according to the passed in execution context.
 /// </summary>
 /// <param name="context">The context of the job.</param>
 /// <returns>The result of the job serialized for transport.</returns>
 public static byte[] ExecuteIncoming(ExecutionContext context)
 {
     DomainProxy proxy = proxies[context.DomainKey];
     return proxy.ExecuteIncoming(context.MethodName, context.TypeName, context.AssemblyName, context.Parameter);
 }