1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
public void removeSubProcess(GTMSubProcess gtmSubProcess)
{
try
{
if (gtmSubProcess == null)
throw new Exception("Sous process non renseigné.");
lock (_syncRoot)
{
// -- Récupération des sous-process similaires pouvant éventuellement
// -- se lancer en même temps
// ------------------------------------------------------------
int iIndexSubProcessToRemove = GTMSubProcessCollection.indexOf(this.listGTMSubProcessRegistered,
gtmSubProcess.SIdInternalSchedulerSubProcess);
// -- Mise à jour du sous-process exécuté
// --------------------------------------
gtmSubProcess.GtmProcessInfo.State = GTMEnum.GTMAppState.WaitingStart;
gtmSubProcess.DtNextExecution = GTMSubProcessCollection.getDailyNextDate(gtmSubProcess.ListPeriodScheduler);
gtmSubProcess.LastElapsedTime = DateTime.Now.Subtract(gtmSubProcess.DtStartExecution);
// -- Selon l'emplacement du scheduler et le type de connexion
// -- Mise à jour de l'état du sous process
// ------------------------------------------------------------
GTMSubProcessDAO.Instance.updateSubProcess(gtmSubProcess);
// -- Suppression du sous-process
// ------------------------------
if (iIndexSubProcessToRemove > -1)
{
this.listGTMSubProcessRegistered.RemoveAt(iIndexSubProcessToRemove);
this.removeGUID(gtmSubProcess.SIdInternalSchedulerSubProcess);
}
}
// -- Appel de la méthode callback
// -- sur les utilisateurs connectés
// ---------------------------------
foreach (ICallbackGTMScheduler ic in subscribers.ToList())
ic.subProcessStopped(gtmSubProcess);
}
catch (Exception ex)
{
adviseClientsAboutSchedulerException("GTMScheduler.removeSubProcess :" + ex.Message);
}
} |
Partager