コード例 #1
0
        private void PopulateKeys(NodeHeartbeatRequest request, NodeHeartbeatResponse nodeHeartBeatResponse
                                  )
        {
            // Check if node's masterKey needs to be updated and if the currentKey has
            // roller over, send it across
            // ContainerTokenMasterKey
            MasterKey nextMasterKeyForNode = this.containerTokenSecretManager.GetNextKey();

            if (nextMasterKeyForNode != null && (request.GetLastKnownContainerTokenMasterKey(
                                                     ).GetKeyId() != nextMasterKeyForNode.GetKeyId()))
            {
                nodeHeartBeatResponse.SetContainerTokenMasterKey(nextMasterKeyForNode);
            }
            // NMTokenMasterKey
            nextMasterKeyForNode = this.nmTokenSecretManager.GetNextKey();
            if (nextMasterKeyForNode != null && (request.GetLastKnownNMTokenMasterKey().GetKeyId
                                                     () != nextMasterKeyForNode.GetKeyId()))
            {
                nodeHeartBeatResponse.SetNMTokenMasterKey(nextMasterKeyForNode);
            }
        }
コード例 #2
0
        public static NodeHeartbeatResponse NewNodeHeartbeatResponse(int responseId, NodeAction
                                                                     action, IList <ContainerId> containersToCleanUp, IList <ApplicationId> applicationsToCleanUp
                                                                     , MasterKey containerTokenMasterKey, MasterKey nmTokenMasterKey, long nextHeartbeatInterval
                                                                     )
        {
            NodeHeartbeatResponse response = recordFactory.NewRecordInstance <NodeHeartbeatResponse
                                                                              >();

            response.SetResponseId(responseId);
            response.SetNodeAction(action);
            response.SetContainerTokenMasterKey(containerTokenMasterKey);
            response.SetNMTokenMasterKey(nmTokenMasterKey);
            response.SetNextHeartBeatInterval(nextHeartbeatInterval);
            if (containersToCleanUp != null)
            {
                response.AddAllContainersToCleanup(containersToCleanUp);
            }
            if (applicationsToCleanUp != null)
            {
                response.AddAllApplicationsToCleanup(applicationsToCleanUp);
            }
            return(response);
        }