LogRecordSequence.TailPinned 事件    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
发信号通知需要移动序列的尾数据。
public:
 virtual event EventHandler<System::IO::Log::TailPinnedEventArgs ^> ^ TailPinned;public event EventHandler<System.IO.Log.TailPinnedEventArgs> TailPinned;member this.TailPinned : EventHandler<System.IO.Log.TailPinnedEventArgs> Public Custom Event TailPinned As EventHandler(Of TailPinnedEventArgs) 事件类型
实现
示例
此示例演示如何使用 TailPinned 事件。
recordSequence.RetryAppend = true;  
recordSequence.TailPinned += new EventHandler<TailPinnedEventArgs>(HandleTailPinned);  
void HandleTailPinned(object sender, TailPinnedEventArgs tailPinnedEventArgs)  
{  
   // tailPinnedEventArgs.TargetSequenceNumber is the target   
   // sequence number to free up space to.    
   // However, this sequence number is not necessarily valid.  We have  
   // to use this sequence number as a starting point for finding a  
   // valid point within the log to advance toward. You need to  
   // identify a record with a sequence number equal to, or greater  
   // than TargetSequenceNumber; let's call this   
   // realTargetSequenceNumber. Once found, move the base  
   recordSequence.AdvanceBaseSequenceNumber(realTargetSequenceNumber);  
}  
注解
可以在记录序列空间不足时激发此事件。 此事件激发时,序列的尾数据(即基序列号)将前移以释放空间。
当记录序列决定必须释放空间时,可以借任何理由随时激发该事件。 例如,当 CLFS 策略引擎确定共享同一日志文件的两个日志客户端的结尾相距过远时,它可能会决定激发该事件。 可以通过写入重新开始区域、截断日志及使用 AdvanceBaseSequenceNumber 方法清除空间来释放空间。 “示例”部分的代码示例演示了第二种方式。
还可以在 WriteRestartArea 事件之外调用 TailPinned 方法以释放空间。 重新开始区域类似于其他日志处理系统内的检查点。 调用此方法则表示,在重新开始区域彻底完成以及可用于在以后追加记录之前,应用程序将考虑以前的所有记录。 与其他任何记录类似,此方法写入的记录需要使用日志中实际的可用空间才有效。