private void ServiceCannotBeScheduled(ServiceInstance request) { try { AsLockable(request).Unlock(_instanceLock); WriteLog(String.Format("Request '{0}' cannot be scheduled and its instance is aborted", request.DebugInfo()), LogMessageType.Warning); request.SchedulingInfo.SchedulingStatus = SchedulingStatus.CouldNotBeScheduled; request.Abort(); } catch (Exception ex) { WriteLog(String.Format("Failed to set service as unscheduled, ex: {0}", ex.Message), ex); } finally { // add to update UI with requests that cannot be scheduled, this request will be removed on the next Schedule() by RemoveNotRelevantRequests() _scheduledRequests.Add(request); AsLockable(request).Lock(_instanceLock); } }