Esempio 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;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public static LogDataBase GetInit()
 {
     if (_logDataBase == null)
     {
         lock (_lock)
         {
             if (_logDataBase == null)
             {
                 _logDataBase = new LogDataBase();
             }
         }
     }
     return(_logDataBase);
 }