private ServiceInstance CreateServiceInstance(ServiceConfiguration config, SchedulingRule rule, DateTime requestedTime) { try { ServiceInstance request = Environment.NewServiceInstance(config); request.SchedulingInfo = new SchedulingInfo { SchedulingStatus = SchedulingStatus.New, SchedulingScope = rule.Scope, RequestedTime = requestedTime, MaxDeviationBefore = rule.MaxDeviationBefore, MaxDeviationAfter = rule.MaxDeviationAfter, }; AsLockable(request).Lock(_instanceLock); return(request); } catch (Exception ex) { WriteLog(String.Format("Failed create instance for service '{0}' rule '{1}', ex: {2}", config.DebugInfo(), rule.DebugInfo(), ex.Message), ex); } return(null); }