Clerk.ForceLog 方法

定义

强制将所有日志记录存入磁盘。

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 会使所有已写入磁盘的日志记录持久。

适用于