private void prepareContext(ContainerAllocationTaskState state,
ContainerDescription containerDesc) {
if (state.postAllocation) {
proceedTo(SubStage.PLACEMENT_HOST_SELECTED);
return;
}
if (containerDesc == null) {
getContainerDescription(state, (contDesc) -> this.prepareContext(state, contDesc));
return;
}
proceedTo(SubStage.CONTEXT_PREPARED, s -> {
s.customProperties = mergeCustomProperties(containerDesc.customProperties,
state.customProperties);
if (s.getCustomProperty(FIELD_NAME_CONTEXT_ID_KEY) == null) {
s.addCustomProperty(FIELD_NAME_CONTEXT_ID_KEY, getSelfId());
}
s.descName = containerDesc.name;
});
}