Beispiel #1
0
        private void LockStreamWithRetry()
        {
            MapiStream mapiStream = this.oofHistoryStream as MapiStream;

            if (mapiStream == null)
            {
                return;
            }
            for (int i = 0; i < 6; i++)
            {
                try
                {
                    mapiStream.LockRegion(0L, 1L, 1);
                    this.streamLocked = true;
                    this.Trace("Oof history stream locked.");
                    break;
                }
                catch (MapiExceptionLockViolation argument)
                {
                    if (i == 5)
                    {
                        throw;
                    }
                    this.context.TraceError <int, MapiExceptionLockViolation>("Failed to lock on attempt {0}. Exception encountered is {1}.", i, argument);
                    Thread.Sleep(100);
                }
            }
        }
Beispiel #2
0
 private static void LockStreamWithRetry(MapiStream oofHistoryStream, long hashCode)
 {
     for (int i = 0; i < 6; i++)
     {
         try
         {
             oofHistoryStream.LockRegion(0L, 1L, 1);
             break;
         }
         catch (MapiExceptionLockViolation arg)
         {
             if (i == 5)
             {
                 throw;
             }
             OofHistory.Tracer.TraceDebug <int, int, MapiExceptionLockViolation>(hashCode, "Failed to lock on attempt {0}, sleeping {1} milliseconds. Exception encountered is {2}.", i, 100, arg);
             Thread.Sleep(100);
         }
     }
 }