Exemplo n.º 1
0
 public void StartBatchJob(Action <int> handler, BatchJobOptions options)
 {
     lock (batchJobLock)
     {
         if (batchJob == null || !batchJob.IsRunning)
         {
             batchJob = new BatchJob(options, logger);
             batchJob.Start(handler);
         }
         else
         {
             throw new InvalidOperationException("Batch job already started.");
         }
     }
 }
Exemplo n.º 2
0
 public void StopBatchJob()
 {
     lock (batchJobLock)
     {
         if (batchJob != null)
         {
             try
             {
                 batchJob.Stop();
             }
             finally
             {
                 batchJob = null;
             }
         }
         else
         {
             throw new InvalidOperationException("Batch job does not exist.");
         }
     }
 }