Click or drag to resize

JCOBridgeDisposeAsyncScope Constructor

Initializes a new batch dispose scope for async contexts. Disposal of JVM objects within this scope is batched and flushed in a single native call when the scope exits. The scope state flows automatically across await continuations.

Namespace: MASES.JCOBridge.C2JBridge
Assembly: C2JBridge (in C2JBridge.dll) Version: 2.6.9.260611-9a148513a79c26cdd7f1dde468f4f9e06ef3bc7e
Syntax
public JCOBridgeDisposeAsyncScope(
	int maxPerBatch = 64
)

Parameters

maxPerBatch  Int32  (Optional)
Maximum number of JVM references to queue before an automatic flush is triggered. Defaults to 64.
Example
C#
await using var scope = new JCOBridgeDisposeAsyncScope();
await foreach (var item in asyncCollection)
{
    using (item) { /* item disposal is batched */ }
}
See Also