ReservationCollection.Remove(Int64) 方法

定义

释放指定大小的预留(如果已生成)。Releases a reservation of the specified size, if one has been made. 无法继承此方法。This method cannot be inherited.

public:
 virtual bool Remove(long item);
public bool Remove (long item);
abstract member Remove : int64 -> bool
override this.Remove : int64 -> bool
Public Function Remove (item As Long) As Boolean

参数

item
Int64

要释放的预留的大小。The size of the reservation to release.

返回

Boolean

如果已找到并移除指定大小的预留,则为 true;否则为 falsetrue if a reservation of the specified size was found and removed; otherwise, false.

实现

例外

在指定的预留集合中找不到足以容纳提供的记录的预留。No reservation large enough to fit the provided record can be found in the specified reservation collection.

创建存档快照时发生 I/O 错误。An I/O error occurs when creating the archive snapshot.

该方法是在序列已释放之后调用的。The method was called after the sequence has been disposed of.

没有足够的内存来继续执行该程序。There is not enough memory to continue the execution of the program.

记录序列已满。The record sequence is full.

操作系统拒绝了对指定的日志存储区的访问。Access for the specified log store is denied by the operating system.

示例

下面的示例演示如何以手动方式生成预留。The following example shows how to manually make a reservation. 请注意,只有在使用基于 CLFS 的 LogRecordSequence 类时才能执行此任务。Notice that this task can only be performed when using the CLFS-based LogRecordSequence class.

ReservationCollection reservations = recordSequence.CreateReservationCollection();  
reservations.Add(lengthOfUndoRecord);  
try  
{  
   recordSequence.Append(recordData, userSqn, previousSqn, RecordAppendOptions.None);  
}  
catch (Exception)  
{  
   reservations.Remove(lengthOfUndoRecord);  
   throw;  
}  

recordSequence.Append(undoRecordData, userSqn, previousSqn, RecordAppendOptions.ForceFlush, reservations);  

适用于