Clerk.ForceLog 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
强制将所有日志记录存入磁盘。
public:
void ForceLog();
public void ForceLog ();
member this.ForceLog : unit -> unit
Public Sub ForceLog ()
示例
下面的代码示例演示了此方法的使用。
// Create a record of previous account status, and deliver it to the
// clerk.
int balance = ReadAccountBalance(Filename);
array<Object^>^ record = gcnew array<Object^>(2);
record[0] = Filename;
record[1] = balance;
clerk->WriteLogRecord(record);
clerk->ForceLog();
// Create a record of previous account status, and deliver it to the clerk.
int balance = AccountManager.ReadAccountBalance(filename);
Object[] record = new Object[2];
record[0] = filename;
record[1] = balance;
clerk.WriteLogRecord(record);
clerk.ForceLog();
' Create a record of previous account status, and deliver it to the clerk.
Dim balance As Integer = AccountManager.ReadAccountBalance(Filenam)
Dim record(1) As [Object]
record(0) = filename
record(1) = balance
clerk.WriteLogRecord(record)
clerk.ForceLog()
注解
补偿资源管理器 (CRM) Worker 和 CRM 补偿器使用此方法懒散地将记录写入日志,这意味着在强制写入日志之前,记录不会持久。 调用 ForceLog 会使所有已写入磁盘的日志记录持久。