Rediger

Del via


FileRecordSequence.BeginFlush(SequenceNumber, AsyncCallback, Object) Method

Definition

Begins an asynchronous flush operation, using space previously reserved in the sequence. This method cannot be inherited.

public:
 virtual IAsyncResult ^ BeginFlush(System::IO::Log::SequenceNumber sequenceNumber, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginFlush (System.IO.Log.SequenceNumber sequenceNumber, AsyncCallback callback, object state);
abstract member BeginFlush : System.IO.Log.SequenceNumber * AsyncCallback * obj -> IAsyncResult
override this.BeginFlush : System.IO.Log.SequenceNumber * AsyncCallback * obj -> IAsyncResult
Public Function BeginFlush (sequenceNumber As SequenceNumber, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

sequenceNumber
SequenceNumber

The sequence number of the latest record that must be written. If SequenceNumber is invalid, then all records must be written.

callback
AsyncCallback

An optional asynchronous callback, to be called when the flush is complete.

state
Object

A user-provided object that distinguishes this particular asynchronous flush request from other requests.

Returns

An IAsyncResult that represents the asynchronous flush operation, which could still be pending.

Implements

Exceptions

One or more of the arguments is invalid.

sequenceNumber is not valid for this sequence.

sequenceNumber is not between the base and last sequence numbers of this sequence.

An I/O error occurred while flushing the data.

The method was called after the sequence has been disposed of.

There is not enough memory to continue the execution of the program.

Remarks

You should pass the IAsyncResult returned by the current method to the EndFlush method to ensure that the flush completes and resources are freed appropriately. If an error occurs during an asynchronous flush, an exception is not thrown until the EndFlush method is called with the IAsyncResult returned by this method.

Calling this method ensures that all records that have been appended to the FileRecordSequence are durably written.

If a record sequence has been disposed of, or if you pass an invalid argument, exceptions are thrown immediately within this operation. Errors that occurred during an asynchronous flush request, for example, a disk failure during the I/O request, will result in exceptions being thrown when the EndFlush method is called.

Applies to