Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
DatabaseEnvironment..::.CloseForceSync Method
DatabaseEnvironment Class See Also Send Feedback

Close the Berkeley DB environment, freeing any allocated resources, closing any open databases as well as underlying subsystems.

Namespace: BerkeleyDB
Assembly: libdb_dotnet60 (in libdb_dotnet60.dll) Version: 6.0.20.0

# Syntax

C#
    public void CloseForceSync()

Visual Basic (Declaration)
    Public Sub CloseForceSync

Visual C++
    public:
    void CloseForceSync()

# Remarks

The object should not be closed while any other handle that refers to it is not yet closed; for example, database environment handles must not be closed while transactions in the environment have not yet been committed or aborted. If there are open database handles, they are all closed, and each of them will be synced on close. The first error in the close operations, if any, is returned at last, and the environment close procedures will carry on anyway.

Where the environment was configured with UseTxns, calling CloseForceSync aborts any unresolved transactions. Applications should not depend on this behavior for transactions involving Berkeley DB databases; all such transactions should be explicitly resolved. The problem with depending on this semantic is that aborting an unresolved transaction involving database operations requires a database handle. Because the database handles should have been closed before calling CloseForceSync, it will not be possible to abort the transaction, and recovery will have to be run on the Berkeley DB environment before further operations are done.

In multithreaded applications, only a single thread may call CloseForceSync.

# See Also

DatabaseEnvironment Class
BerkeleyDB Namespace