コード例 #1
0
        internal void ReplaceStructureHolder(LogWriterStructureHolder newStructureHolder)
        {
            try
            {
                structureHolderLock.AcquireWriterLock(writerLockAcquireTimeout);
                try
                {
                    // Switch old and new structures.
                    LogWriterStructureHolder oldStructureHolder = structureHolder;
                    structureHolder = newStructureHolder;
                    filter          = new LogFilterHelper(structureHolder.Filters, this);

                    // Dispose has to be fully performed before allowing the new structure to be used.
                    oldStructureHolder.Dispose();
                }
                finally
                {
                    structureHolderLock.ReleaseWriterLock();
                }
            }
            catch (ApplicationException)
            {
                TryLogLockAcquisitionFailure(Resources.ExceptionFailedToAcquireLockToUpdate);
            }
        }
コード例 #2
0
 /// <summary>
 /// Releases the resources used by the <see cref="LogWriter"/>.
 /// </summary>
 public void Dispose()
 {
     structureHolder.Dispose();
     if (structureUpdater != null)
     {
         structureUpdater.Dispose();
     }
 }