public void RequestNodeStatus(int nodeIndex, int requestId) { ErrorUtilities.VerifyThrow(nodeLoggers != null, "Must call Initialize first"); ErrorUtilities.VerifyThrow(nodeIndex < nodeData.Length && nodeIndex >= 0, "Node index must be within array boundaries"); // If the node has not been launched we need to create a reply // on its behalf if (nodeData[nodeIndex].NodeState != NodeState.Launched) { NodeStatus nodeStatus = new NodeStatus(requestId, false, 0, 0, 0, (nodeData[nodeIndex].NodeState == NodeState.LaunchInProgress)); engineCallback.PostStatus(nodeData[nodeIndex].NodeId, nodeStatus, false); } else if (!IsNodeProcessAliveOrUninitialized(nodeIndex)) { NodeStatus nodeStatus = new NodeStatus(requestId); // Indicate that the node has exited engineCallback.PostStatus(nodeData[nodeIndex].NodeId, nodeStatus, false); } else { // Send the request to the node LocalCallDescriptorForRequestStatus callDescriptor = new LocalCallDescriptorForRequestStatus(requestId); nodeData[nodeIndex].NodeCommandQueue.Enqueue(callDescriptor); } }
/// <summary> /// This method first reads the objectId as an int from the stream, /// this int should be found in the "ObjectType" enumeration. This /// objectId informs the method what kind of object should be /// deserialized and returned from the method. The objectId is an /// output parameter. This parameter is also returned so it can be /// used in the read and write methods to determine if /// a frame or end marker was found. /// </summary> private object DeserializeFromStream(out int objectId) { object objectRead = null; objectId = readStream.ReadByte(); switch ((ObjectType)objectId) { case ObjectType.NetSerialization: objectRead = binaryFormatter.Deserialize(readStream); break; case ObjectType.FrameMarker: objectRead = binaryReader.ReadInt32(); break; case ObjectType.PostBuildResult: objectRead = new LocalCallDescriptorForPostBuildResult(); ((LocalCallDescriptorForPostBuildResult)objectRead).CreateFromStream(binaryReader); break; case ObjectType.PostBuildRequests: objectRead = new LocalCallDescriptorForPostBuildRequests(); ((LocalCallDescriptorForPostBuildRequests)objectRead).CreateFromStream(binaryReader); break; case ObjectType.PostLoggingMessagesToHost: objectRead = new LocalCallDescriptorForPostLoggingMessagesToHost(); ((LocalCallDescriptorForPostLoggingMessagesToHost)objectRead).CreateFromStream(binaryReader, loggingTypeCache); break; case ObjectType.InitializeNode: objectRead = new LocalCallDescriptorForInitializeNode(); ((LocalCallDescriptorForInitializeNode)objectRead).CreateFromStream(binaryReader); break; case ObjectType.InitializationComplete: objectRead = new LocalCallDescriptorForInitializationComplete(); ((LocalCallDescriptorForInitializationComplete)objectRead).CreateFromStream(binaryReader); break; case ObjectType.UpdateNodeSettings: objectRead = new LocalCallDescriptorForUpdateNodeSettings(); ((LocalCallDescriptorForUpdateNodeSettings)objectRead).CreateFromStream(binaryReader); break; case ObjectType.RequestStatus: objectRead = new LocalCallDescriptorForRequestStatus(); ((LocalCallDescriptorForRequestStatus)objectRead).CreateFromStream(binaryReader); break; case ObjectType.PostCacheEntriesToHost: objectRead = new LocalCallDescriptorForPostingCacheEntriesToHost(); ((LocalCallDescriptorForPostingCacheEntriesToHost)objectRead).CreateFromStream(binaryReader); break; case ObjectType.GetCacheEntriesFromHost: objectRead = new LocalCallDescriptorForGettingCacheEntriesFromHost(); ((LocalCallDescriptorForGettingCacheEntriesFromHost)objectRead).CreateFromStream(binaryReader); break; case ObjectType.ShutdownComplete: objectRead = new LocalCallDescriptorForShutdownComplete(); ((LocalCallDescriptorForShutdownComplete)objectRead).CreateFromStream(binaryReader); break; case ObjectType.ShutdownNode: objectRead = new LocalCallDescriptorForShutdownNode(); ((LocalCallDescriptorForShutdownNode)objectRead).CreateFromStream(binaryReader); break; case ObjectType.PostIntrospectorCommand: objectRead = new LocalCallDescriptorForPostIntrospectorCommand(null, null); ((LocalCallDescriptorForPostIntrospectorCommand)objectRead).CreateFromStream(binaryReader); break; case ObjectType.GenericSingleObjectReply: objectRead = new LocalReplyCallDescriptor(); ((LocalReplyCallDescriptor)objectRead).CreateFromStream(binaryReader); break; case ObjectType.PostStatus: objectRead = new LocalCallDescriptorForPostStatus(); ((LocalCallDescriptorForPostStatus)objectRead).CreateFromStream(binaryReader); break; case ObjectType.EndMarker: return(null); default: ErrorUtilities.VerifyThrow(false, "Should not be here, ObjectId:" + objectId + "Next:" + readStream.ReadByte()); break; } return(objectRead); }