DbEnv.close

APIRef

import com.sleepycat.db.*;

public void close(int flags) throws DbException;

Description

The DbEnv.close method closes the Berkeley DB environment, freeing any allocated resources and closing any underlying subsystems.

Calling DbEnv.close does not imply closing any databases that were opened in the environment, and all databases opened in the environment should be closed before the environment is closed.

The flags parameter is currently unused, and must be set to 0.

Where the environment was initialized with the Db.DB_INIT_LOCK flag, calling DbEnv.close does not release any locks still held by the closing process, providing functionality for long-lived locks.

Where the environment was initialized with the Db.DB_INIT_MPOOL flag, calling DbEnv.close implies calls to DbMpoolFile.close for any remaining open files in the memory pool that were returned to this process by calls to DbMpoolFile.open. It does not imply a call to DbMpoolFile.sync for those files.

Where the environment was initialized with the Db.DB_INIT_TXN flag, calling DbEnv.close 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 DbEnv.close, 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 DbEnv.close.

After DbEnv.close has been called, regardless of its return, the Berkeley DB environment handle may not be accessed again.

The DbEnv.close method throws an exception that encapsulates a non-zero error value on failure.

Errors

The DbEnv.close method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbEnv.close method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DbEnv

See Also

DbEnv.close, DbEnv.get_version_string, DbEnv.open, DbEnv.remove, DbEnv.set_cachesize, DbEnv.set_data_dir, DbEnv.set_errcall, DbEnv.set_error_stream, DbEnv.set_errpfx, DbEnv.set_feedback, DbEnv.set_flags, DbEnv.set_mutexlocks, DbEnv.set_pageyield, DbEnv.set_panicstate, DbEnv.set_recovery_init, DbEnv.set_rpc_server, DbEnv.set_region_init, DbEnv.set_shm_key, DbEnv.set_tas_spins, DbEnv.set_tmp_dir, DbEnv.set_verbose, and DbEnv.strerror.

APIRef

Copyright Sleepycat Software