Ejemplo n.º 1
0
 public void RunLog()
 {
     using (BulkInsertOperation bulkInsert = LogDataBase.GetInit()._store.BulkInsert())
     {
         while (true)
         {
             if (_queueLog.Count == 0)
             {
                 Thread.Sleep(1000 * 5);
             }
             var bo = _queueLog.TryDequeue(out log _log);
             if (bo)
             {
                 try
                 {
                     bulkInsert.Store(_log);
                 }
                 catch (Exception ex)
                 {
                     bulkInsert.Dispose();
                     Thread.Sleep(1000 * 10);
                     _queueLog.Enqueue(_log);
                     break;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void TryDispose(ref BulkInsertOperation bulkInsert)
 {
     if (bulkInsert == null)
     {
         return;
     }
     try
     {
         bulkInsert.Dispose();
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine("Failed to dispose bulk insert operation. \n" + ex.ToString());
     }
     bulkInsert = null;
 }
Ejemplo n.º 3
0
 public void Dispose()
 {
     _operation.Dispose();
 }
 public void Dispose()
 {
     _notifications.OnDocumentRead -= DocumentFound;
     _bulkInsert?.Dispose();
 }