/* * ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version: 1.3.19 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package com.sleepycat.db; /** * The DbEnv object is the handle for a Berkeley DB environment -- a * collection including support for some or all of caching, locking, * logging and transaction subsystems, as well as databases and log * files. Methods off the DbEnv handle are used to configure the * environment as well as to operate on subsystems and databases in * the environment.

* * DbEnv handles are free-threaded if the {@link * com.sleepycat.db.Db#DB_THREAD Db.DB_THREAD} flag is specified to * the {@link com.sleepycat.db.DbEnv#open DbEnv.open} method when the * environment is opened. The DbEnv handle should not be closed while * any other handle remains open that is using it as a reference (for * example, {@link com.sleepycat.db.Db Db} or {@link * com.sleepycat.db.DbTxn DbTxn}). Once either the {@link * com.sleepycat.db.DbEnv#close DbEnv.close} or {@link * com.sleepycat.db.DbEnv#remove DbEnv.remove} methods are called, * the handle may not be accessed again, regardless of the method's * return.

*/ public class DbEnv { private long swigCPtr; protected boolean swigCMemOwn; protected DbEnv(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected DbEnv() { this(0, false); } protected void delete() { if (swigCPtr != 0 && swigCMemOwn) { swigCMemOwn = false; } swigCPtr = 0; } protected static long getCPtr(DbEnv obj) { return (obj == null) ? 0 : obj.swigCPtr; } // Internally, the JNI layer creates a global reference to each DbEnv, // which can potentially be different to this. We keep a copy here so // we can clean up after destructors. private Object dbenv_ref; private DbAppDispatch app_dispatch_handler; private DbEnvFeedbackHandler env_feedback_handler; private DbErrorHandler error_handler; private DbPanicHandler panic_handler; private DbRepTransport rep_transport_handler; private String errpfx; public static class RepProcessMessage { /** * The envid field contains the local identifier of * the environment returned by the * DbEnv.replicationProcessMessage method. * * */ public int envid; } // Called by the public DbEnv constructor and for private environments // by the Db constructor. void initialize() { dbenv_ref = db_java.initDbEnvRef0(this, this); // Start with System.err as the default error stream. set_error_stream(System.err); } void cleanup() { swigCPtr = 0; db_java.deleteRef0(dbenv_ref); dbenv_ref = null; } /** * The DbEnv.close method closes the Berkeley DB environment, * freeing any allocated resources and closing any underlying * subsystems.

* * The {@link com.sleepycat.db.DbEnv DbEnv} handle 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 database handles remain open, or transactions in * the environment have not yet been committed or aborted. * Specifically, this includes {@link com.sleepycat.db.Db Db}, * {@link com.sleepycat.db.Dbc Dbc}, {@link * com.sleepycat.db.DbTxn DbTxn}, {@link com.sleepycat.db.DbLogc * DbLogc} and {@link com.sleepycat.db.DbMpoolFile DbMpoolFile} * handles.

* * Where the environment was initialized with the {@link * com.sleepycat.db.Db#DB_INIT_LOCK 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 {@link * com.sleepycat.db.Db#DB_INIT_TXN 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.

* * Where log cursors were created using the {@link * com.sleepycat.db.DbEnv#logCursor DbEnv.logCursor} method, * calling DbEnv.close does not imply closing those cursors.

*

* * 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. *

* * @param flags currently unused, and must be set to 0. * @throws DbException Signals that an exception of some sort * has occurred. */ public synchronized void close(int flags) throws DbException { try { close0(flags); } finally { cleanup(); } } private final int handle_app_dispatch(Dbt dbt, DbLsn lsn, int recops) { return app_dispatch_handler.appDispatch(this, dbt, lsn, recops); } private final void handle_env_feedback(int opcode, int percent) { env_feedback_handler.feedback(this, opcode, percent); } private final void handle_error(String msg) { error_handler.error(this.errpfx, msg); } private final void handle_panic(DbException e) { panic_handler.panic(this, e); } private final int handle_rep_transport(Dbt control, Dbt rec, DbLsn lsn, int flags, int envid) throws DbException { return rep_transport_handler.send(this, control, rec, lsn, flags, envid); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockVector(int,int,DbLockRequest[],int,int)} */ public void lock_vec(int locker, int flags, DbLockRequest[] list, int offset, int count) throws DbException { lockVector(locker, flags, list, offset, count); } /** * The DbEnv.lockVector method atomically obtains and releases * one or more locks from the lock table. The DbEnv.lockVector * method is intended to support acquisition or trading of * multiple locks under one lock table semaphore, as is needed * for lock coupling or in multigranularity locking for lock * escalation.

* * If any of the requested locks cannot be acquired, or any of * the locks to be released cannot be released, the operations * before the failing operation are guaranteed to have completed * successfully, and DbEnv.lockVector throws an exception

* * @param flags must be set to 0 or the * following value: * * * @param locker an unsigned 32-bit integer * quantity. It represents the entity requesting or releasing * the lock. * @param list The list array * provided to DbEnv.lockVector is a set of DbLockRequest * objects. Only count elements of list * starting at offset are considered by * DbEnv.lockVector. A DbLockRequest object has at least the * following fields:

* * A DB_LOCKREQ structure has at least the following fields: *

* * The operation to be performed, which must be set to one of * the following values: *

* * * * * * * * * * * A lock reference.

* * The lock mode, used as an index into the environment's * lock conflict matrix. When using the default lock conflict * matrix, mode must be set to one of the following * values: *

* * * * * * * * * See {@link com.sleepycat.db.DbEnv#setLockConflicts * DbEnv.setLockConflicts} and Standard Lock * Modes for more information on the lock conflict * matrix.

* * An untyped byte string that specifies the object to be * locked or released. Applications using the locking * subsystem directly while also doing locking via the * Berkeley DB access methods must take care not to * inadvertently lock objects that happen to be equal to the * unique file IDs used to lock files. See Access method * locking conventions for more information.

* * The lock timeout value. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the DbEnv.lockVector method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the DbEnv.lockVector method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws DbLockNotGrantedException If the {@link * com.sleepycat.db.Db#DB_LOCK_NOWAIT Db.DB_LOCK_NOWAIT} flag * or lock timers were configured and the lock could not be * granted before the wait-time expired, the DbEnv.lockVector * method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The DbEnv.lockVector method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @throws DbMemoryException If the maximum number of * locks has been reached, the DbEnv.lockVector method will * fail and throw a {@link com.sleepycat.db.DbMemoryException * DbMemoryException} exception. */ public void lockVector(int locker, int flags, DbLockRequest[] list, int offset, int count) throws DbException { db_javaJNI.DbEnv_lock_vec(swigCPtr, locker, flags, list, offset, count); } /** * The DbEnv.open method opens a Berkeley DB environment. It * provides a structure for creating a consistent environment for * processes using one or more of the features of Berkeley DB. *

* * @param db_home the database environment's * home directory. For more information on db_home , * and filename resolution in general, see Berkeley DB File * Naming . The environment variable DB_HOME may * be used as the path of the database home, as described in * Berkeley DB * File Naming . * @param flags specifies the subsystems * that are initialized and how the application's environment * affects Berkeley DB file naming, among other things. The * flags parameter must be set to 0 or by bitwise * inclusively OR 'ing together one or more of the * following values:

* * Because there are a large number of flags that can be * specified, they have been grouped together by * functionality. The first group of flags indicates which of * the Berkeley DB subsystems should be initialized:

* * * * * * * * * * * * * * The second group of flags govern what recovery, if any, is * performed when the environment is initialized:

* * * * A standard part of the recovery process is to remove the * existing Berkeley DB environment and create a new one in * which to perform recovery. If the thread of control * performing recovery does not specify the correct region * initialization information (for example, the correct * memory pool cache size), the result can be an application * running in an environment with incorrect cache and other * subsystem sizes. For this reason, the thread of control * performing recovery should specify correct configuration * information before calling the DbEnv.open method; or it * should remove the environment after recovery is completed, * leaving creation of the correctly sized environment to a * subsequent call to DbEnv.open.

* * All Berkeley DB recovery processing must be * single-threaded; that is, only a single thread of control * may perform recovery or access a Berkeley DB environment * while recovery is being performed. Because it is not an * error to specify Db.DB_RECOVER for an environment for * which no recovery is required, it is reasonable * programming practice for the thread of control responsible * for performing recovery and creating the environment to * always specify the Db.DB_CREATE and Db.DB_RECOVER flags * during startup.

* * The DbEnv.open function returns successfully if * Db.DB_RECOVER or Db.DB_RECOVER_FATAL is specified and no * log files exist, so it is necessary to ensure that all * necessary log files are present before running recovery. * For further information, consult db_archive * and * db_recover .

* * The third group of flags govern file-naming extensions in * the environment:

* * * * Finally, there are a few additional unrelated flags:

* * * * * * * * * * * * @param mode On UNIX systems or in * IEEE/ANSI Std 1003.1 (POSIX) environments, all files * created by Berkeley DB are created with mode mode * (as described in chmod (2)) and modified by the * process' umask value at the time of creation (see umask * (2)). If mode is 0, Berkeley DB will use a * default mode of readable and writable by both owner and * group. On Windows systems, the mode parameter is ignored. * The group ownership of created files is based on the * system and directory defaults, and is not further * specified by Berkeley DB. * @throws DbException The DbEnv.open method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • The shared memory region was locked and (repeatedly) * unavailable. *
  • HP-UX only: a previously created Berkeley DB * environment for this process still exists. * @throws IllegalArgumentException The DbEnv.open method will * fail and throw a IllegalArgumentException exception if the * Db.DB_THREAD flag was specified and fast mutexes are not * available for this architecture; The DB_HOME or TMPDIR * environment variables were set, but empty; An incorrectly * formatted NAME VALUE entry or line was found; or if * an invalid flag value or parameter was specified. * @throws FileNotFoundException If the file or directory * does not exist, the DbEnv.open method will fail and throw * a FileNotFoundException exception. */ public void open(String db_home, int flags, int mode) throws DbException, java.io.FileNotFoundException { /* * Java is always threaded */ flags |= Db.DB_THREAD; open0(db_home, flags, mode); } /** * The DbEnv.remove method destroys a Berkeley DB environment if * it is not currently in use. The environment regions, including * any backing files, are removed. Any log or database files and * the environment directory are not removed.

    * * If there are processes that have called {@link * com.sleepycat.db.DbEnv#open DbEnv.open} without calling {@link * com.sleepycat.db.DbEnv#close DbEnv.close} (that is, there are * processes currently using the environment), DbEnv.remove will * fail without further action unless the {@link * com.sleepycat.db.Db#DB_FORCE Db.DB_FORCE} flag is set, in * which case DbEnv.remove will attempt to remove the * environment, regardless of any processes still using it.

    *

    * * The result of attempting to forcibly destroy the environment * when it is in use is unspecified. Processes using an * environment often maintain open file descriptors for shared * regions within it. On UNIX systems, the environment removal * will usually succeed, and processes that have already joined * the region will continue to run in that region without change. * However, processes attempting to join the environment will * either fail or create new regions. On other systems in which * the unlink (2) system call will fail if any process has * an open file descriptor for the file (for example Windows/NT), * the region removal will fail.

    * * Calling DbEnv.remove should not be necessary for most * applications because the Berkeley DB environment is cleaned up * as part of normal database recovery procedures. However, * applications may want to call DbEnv.remove as part of * application shut down to free up system resources. For * example, if the {@link com.sleepycat.db.Db#DB_SYSTEM_MEM * Db.DB_SYSTEM_MEM} flag was specified to {@link * com.sleepycat.db.DbEnv#open DbEnv.open}, it may be useful to * call DbEnv.remove in order to release system shared memory * segments that have been allocated. Or, on architectures in * which mutexes require allocation of underlying system * resources, it may be useful to call DbEnv.remove in order to * release those resources. Alternatively, if recovery is not * required because no database state is maintained across * failures, and no system resources need to be released, it is * possible to clean up an environment by simply removing all the * Berkeley DB files in the database environment's directories. *

    * * In multithreaded applications, only a single thread may call * DbEnv.remove.

    * * A {@link com.sleepycat.db.DbEnv DbEnv} handle that has already * been used to open an environment should not be used to call * the DbEnv.remove method; a new {@link com.sleepycat.db.DbEnv * DbEnv} handle should be created for that purpose.

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

    * * @param db_home The db_home parameter * names the database environment to be removed. * @param flags must be set to 0 or by bitwise * inclusively OR 'ing together one or more of the * following values: * * * * * * * @throws DbException The DbEnv.remove method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • The shared memory region was in use and the force * flag was not set. * @throws FileNotFoundException If the file or directory does * not exist, the DbEnv.remove method will fail and throw a * FileNotFoundException exception. */ public synchronized void remove(String db_home, int flags) throws DbException, java.io.FileNotFoundException { try { remove0(db_home, flags); } finally { cleanup(); } } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setCacheSize(long,int)} */ public void set_cachesize(int gbytes, int bytes, int ncache) throws DbException { set_cachesize((long) gbytes * Db.GIGABYTE + bytes, ncache); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getErrorPrefix()} */ public String get_errpfx() { return getErrorPrefix(); } /** * The DbEnv.getErrorPrefix method returns the error prefix.

    *

    * * The DbEnv.getErrorPrefix method may be called at any time * during the life of the application.

    * * @return The DbEnv.getErrorPrefix method returns the error * prefix.

    */ public String getErrorPrefix() { return this.errpfx; } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setErrorHandler(DbErrorHandler)} */ public void set_errcall(DbErrcall db_errcall_fcn) throws DbException { final DbErrcall ferrcall = db_errcall_fcn; try { setErrorHandler( new DbErrorHandler() { public void error(String prefix, String buffer) { ferrcall.errcall(prefix, buffer); } }); } catch (DbException dbe) { // setErrorHandler throws an exception, // but set_error_stream does not. // If it does happen, report it. System.err.println("Exception during DbEnv.setErrorHandler: " + dbe); dbe.printStackTrace(System.err); } } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setErrorStream(java.io.OutputStream)} */ public void set_error_stream(java.io.OutputStream stream) { setErrorStream(stream); } /** * When an error occurs in the Berkeley DB library, an exception * is thrown. In some cases, however, the error information known * to the Java layer may be insufficient to completely describe * the cause of the error, especially during initial application * debugging.

    * * The DbEnv.setErrorStream and {@link * com.sleepycat.db.Db#setErrorStream Db.setErrorStream} methods * are used to enhance the mechanism for reporting error messages * to the application by setting a OutputStream to be used for * displaying additional Berkeley DB error messages. In some * cases, when an error occurs, Berkeley DB will output an * additional error message to the specified stream.

    * * The error message will consist of the prefix string and a * colon (": ") (if a prefix string was previously * specified using {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}), an error string, and a trailing * <newline> character.

    * * Alternatively, you can use the {@link * com.sleepycat.db.DbEnv#setErrorHandler DbEnv.setErrorHandler} * method to capture the additional error information in a way * that does not use output streams. You should not mix these * approaches.

    * * This error-logging enhancement does not slow performance or * significantly increase application size, and may be run during * normal operation as well as during application debugging.

    * * @param stream the application-specified output stream to be * used for additional error information. */ public void setErrorStream(java.io.OutputStream stream) { final java.io.PrintWriter pw = new java.io.PrintWriter(stream); try { setErrorHandler( new DbErrorHandler() { public void error(String prefix, String buf) { if (prefix != null) { pw.print(prefix + ": "); } pw.println(buf); pw.flush(); } }); } catch (DbException dbe) { // setErrorHandler throws an exception, // but set_error_stream does not. // If it does happen, report it. System.err.println("Exception during DbEnv.setErrorHandler: " + dbe); dbe.printStackTrace(System.err); } } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setErrorPrefix(String)} */ public void set_errpfx(String errpfx) { setErrorPrefix(errpfx); } /** * Set the prefix string that appears before error messages * issued by Berkeley DB.

    * * The DbEnv.setErrorPrefix method may be called at any time * during the life of the application.

    * * @param errpfx the application-specified error prefix for * additional error messages. */ public void setErrorPrefix(String errpfx) { this.errpfx = errpfx; } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setFeedbackHandler(DbEnvFeedbackHandler)} */ public void set_feedback(DbEnvFeedback feedback) throws DbException { final DbEnvFeedback ffeedback = feedback; setFeedbackHandler( new DbEnvFeedbackHandler() { public void feedback(DbEnv env, int opcode, int percent) { ffeedback.feedback(env, opcode, percent); } }); } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setReplicationLimit(long)} */ public void set_rep_limit(int gbytes, int bytes) throws DbException { set_rep_limit((long) gbytes * Db.GIGABYTE + bytes); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setTxnTimestamp(java.util.Date)} */ public void set_tx_timestamp(java.util.Date timestamp) throws DbException { setTxnTimestamp(timestamp); } /** * Recover to the time specified by timestamp rather than * to the most current possible date.

    * * Once a database environment has been upgraded to a new version * of Berkeley DB involving a log format change (see Upgrading * Berkeley DB installations ), it is no longer possible to * recover to a specific time before that upgrade.

    * * The DbEnv.setTxnTimestamp method configures operations * performed using the specified {@link com.sleepycat.db.DbEnv * DbEnv} handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setTxnTimestamp method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called.

    * * @param timestamp references the memory * location where the recovery timestamp is located.

    * * Note that only the seconds (not the milliseconds) of the * timestamp are used

    * @throws IllegalArgumentException The DbEnv.setTxnTimestamp * method will fail and throw a IllegalArgumentException * exception if it is not possible to recover to the * specified time using the log files currently present in * the environment; or if an invalid flag value or parameter * was specified. */ public void setTxnTimestamp(java.util.Date timestamp) throws DbException { set_tx_timestamp0(timestamp.getTime() / 1000); } /** * The constructor creates the DbEnv object. The constructor * allocates memory internally; calling the {@link * com.sleepycat.db.DbEnv#close DbEnv.close} or {@link * com.sleepycat.db.DbEnv#remove DbEnv.remove} methods will free * that memory.

    * * @param flags The following flags value may be * specified:

    * * * @throws DbException Signals that an exception of some sort * has occurred. */ public DbEnv(int flags) throws DbException { this(db_javaJNI.new_DbEnv(flags), true); initialize(); } void close0(int flags) { db_javaJNI.DbEnv_close0(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #dbRemove(DbTxn,String,String,int)} */ public void dbremove(DbTxn txnid, String file, String database, int flags) throws DbException, DbDeadlockException, DbLockNotGrantedException, java.io.FileNotFoundException { dbRemove(txnid, file, database, flags); } /** * The DbEnv.dbRemove method removes the database specified by * the file and database parameters. If no * database is specified, the underlying file represented by * file is removed, incidentally removing all of the * databases it contained.

    * * Applications should never remove databases with open {@link * com.sleepycat.db.Db Db} handles, or in the case of removing a * file, when any database in the file has an open handle. For * example, some architectures do not permit the removal of files * with open system handles. On these architectures, attempts to * remove databases currently in use by any thread of control in * the system will fail.

    Environment Variables

    * * The environment variable DB_HOME may be used as the * path of the database environment home.

    * * DbEnv.dbRemove is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param database the database to be removed. * @param file the physical file which * contains the database(s) to be removed. * @param flags must be set to 0 or the * following value: * * * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The DbEnv.dbRemove method * may fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • An attempt was made to remove the underlying file and * a database in the file was currently open. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the DbEnv.dbRemove method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the DbEnv.dbRemove method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The DbEnv.dbRemove method * will fail and throw a IllegalArgumentException exception * if DbEnv.dbRemove called before {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. * @throws FileNotFoundException If the file or directory * does not exist, the DbEnv.dbRemove method will fail and * throw a FileNotFoundException exception. */ public void dbRemove(DbTxn txnid, String file, String database, int flags) throws DbException, DbDeadlockException, DbLockNotGrantedException, java.io.FileNotFoundException { db_javaJNI.DbEnv_dbremove(swigCPtr, DbTxn.getCPtr(txnid), file, database, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #dbRename(DbTxn,String,String,String,int)} */ public void dbrename(DbTxn txnid, String file, String database, String newname, int flags) throws DbException, DbDeadlockException, DbLockNotGrantedException, java.io.FileNotFoundException { dbRename(txnid, file, database, newname, flags); } /** * The DbEnv.dbRename method renames the database specified by * the file and database parameters to newname * . If no database is specified, the underlying file * represented by file is renamed, incidentally renaming * all of the databases it contained.

    * * Applications should not rename databases that are currently in * use. If an underlying file is being renamed and logging is * currently enabled in the database environment, no database in * the file may be open when the DbEnv.dbRename method is called. * In particular, some architectures do not permit renaming files * with open handles. On these architectures, attempts to rename * databases that are currently in use by any thread of control * in the system will fail.

    Environment Variables

    *

    * * The environment variable DB_HOME may be used as the * path of the database environment home.

    * * DbEnv.dbRename is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param database the database to be removed. * @param file the physical file which * contains the database(s) to be removed. * @param flags must be set to 0 or the * following value: * * * @param newname the new name of the * database or file. * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The DbEnv.dbRename method * may fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • An attempt was made to rename the underlying file and * a database in the file was currently open. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the DbEnv.dbRename method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the DbEnv.dbRename method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The DbEnv.dbRename method * will fail and throw a IllegalArgumentException exception * if DbEnv.dbRename called before {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. * @throws FileNotFoundException If the file or directory * does not exist, the DbEnv.dbRename method will fail and * throw a FileNotFoundException exception. */ public void dbRename(DbTxn txnid, String file, String database, String newname, int flags) throws DbException, DbDeadlockException, DbLockNotGrantedException, java.io.FileNotFoundException { db_javaJNI.DbEnv_dbrename(swigCPtr, DbTxn.getCPtr(txnid), file, database, newname, flags); } /** * The DbEnv.err, DbEnv.errx, {@link com.sleepycat.db.Db#err * Db.err} and {@link com.sleepycat.db.Db#errx Db.errx} methods * provide error-messaging functionality for applications written * using the Berkeley DB library.

    * * The DbEnv.err method constructs an error message consisting of * the following elements:

    * * If no error callback function has been set using the {@link * com.sleepycat.db.DbEnv#setErrorHandler DbEnv.setErrorHandler} * method, any prefix string specified using the {@link * com.sleepycat.db.DbEnv#setErrorPrefix DbEnv.setErrorPrefix} * method, followed by two separating characters: a colon and a * <space> character.

    * *

    * * Two separating characters: a colon and a <space> * character.

    * * The standard system or Berkeley DB library error string * associated with the error value, as returned by the * {@link com.sleepycat.db.DbEnv#strerror DbEnv.strerror} method. *

    * * This constructed error message is then handled as follows:

    *

    * * If an error callback function has been set (see {@link * com.sleepycat.db.Db#setErrorHandler Db.setErrorHandler} and * {@link com.sleepycat.db.DbEnv#setErrorHandler * DbEnv.setErrorHandler}), that function is called with two * parameters: any prefix string specified (see {@link * com.sleepycat.db.Db#setErrorPrefix Db.setErrorPrefix} and * {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}) and the error message.

    * * If an OutputStream has been set (see {@link * com.sleepycat.db.DbEnv#setErrorStream DbEnv.setErrorStream} * and {@link com.sleepycat.db.Db#setErrorStream * Db.setErrorStream}), the error message is written to that * stream.

    * * If none of these output options has been configured, the error * message is written to System.err, the standard error output * stream.

    * * @param error the error value for which the DbEnv.err and * {@link com.sleepycat.db.Db#err Db.err} methods will * display a explanatory string. * @param message an error message to display. */ public void err(int error, String message) { db_javaJNI.DbEnv_err(swigCPtr, error, message); } /** * The DbEnv.errx and {@link com.sleepycat.db.Db#errx Db.errx} * methods perform identically to the DbEnv.err and {@link * com.sleepycat.db.Db#err Db.err} methods, except that they do * not append the final separator characters and standard error * string to the error message.

    * * @param error the error value for which the DbEnv.err and * {@link com.sleepycat.db.Db#err Db.err} methods will * display a explanatory string. * @param message an error message to display. */ public void errx(String message) { db_javaJNI.DbEnv_errx(swigCPtr, message); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getDataDirs()} */ public String[] get_data_dirs() throws DbException { return getDataDirs(); } /** * The DbEnv.getDataDirs method returns the array of directories. *

    * * The DbEnv.getDataDirs method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getDataDirs method returns the * array of directories.

    */ public String[] getDataDirs() throws DbException { return db_javaJNI.DbEnv_get_data_dirs(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getEncryptFlags()} */ public int get_encrypt_flags() throws DbException { return getEncryptFlags(); } /** * The DbEnv.getEncryptFlags method returns the encryption flags. *

    * * The DbEnv.getEncryptFlags method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getEncryptFlags method returns * the encryption flags.

    */ public int getEncryptFlags() throws DbException { return db_javaJNI.DbEnv_get_encrypt_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getFlags()} */ public int get_flags() throws DbException { return getFlags(); } /** * The DbEnv.getFlags method returns the configuration flags.

    *

    * * The DbEnv.getFlags method may be called at any time during the * life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getFlags method returns the * configuration flags.

    */ public int getFlags() throws DbException { return db_javaJNI.DbEnv_get_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getDbEnvHome()} */ public String get_home() throws DbException { return getDbEnvHome(); } /** * The DbEnv.getDbEnvHome method returns the database environment * home directory.

    * * The DbEnv.getDbEnvHome method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getDbEnvHome method returns the * database environment home directory.

    */ public String getDbEnvHome() throws DbException { return db_javaJNI.DbEnv_get_home(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getOpenFlags()} */ public int get_open_flags() throws DbException { return getOpenFlags(); } /** * The DbEnv.getOpenFlags method returns the open method flags. *

    * * The DbEnv.getOpenFlags method may not be called before the * DbEnv.open method has been called.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getOpenFlags method returns the * open method flags.

    */ public int getOpenFlags() throws DbException { return db_javaJNI.DbEnv_get_open_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getSegmentId()} */ public long get_shm_key() throws DbException { return getSegmentId(); } /** * The DbEnv.getSegmentId method returns the base segment ID.

    *

    * * The DbEnv.getSegmentId method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getSegmentId method returns the * base segment ID.

    */ public long getSegmentId() throws DbException { return db_javaJNI.DbEnv_get_shm_key(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getTestAndSetSpins()} */ public int get_tas_spins() throws DbException { return getTestAndSetSpins(); } /** * The DbEnv.getTestAndSetSpins method returns the test-and-set * spin count.

    * * The DbEnv.getTestAndSetSpins method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getTestAndSetSpins method * returns the test-and-set spin count.

    */ public int getTestAndSetSpins() throws DbException { return db_javaJNI.DbEnv_get_tas_spins(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getTmpDir()} */ public String get_tmp_dir() throws DbException { return getTmpDir(); } /** * The DbEnv.getTmpDir method returns the database environment * temporary file directory.

    * * The DbEnv.getTmpDir method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getTmpDir method returns the * database environment temporary file directory.

    */ public String getTmpDir() throws DbException { return db_javaJNI.DbEnv_get_tmp_dir(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getVerbose(int)} */ public boolean get_verbose(int which) throws DbException { return getVerbose(which); } /** * The DbEnv.getVerbose method returns whether the specified * which parameter is currently set or not.

    * * The DbEnv.getVerbose method may be called at any time during * the life of the application.

    * * @param which the message value for which configuration * is being checked. * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getVerbose method returns * whether the specified which parameter is currently * set or not.

    */ public boolean getVerbose(int which) throws DbException { return db_javaJNI.DbEnv_get_verbose(swigCPtr, which); } void open0(String db_home, int flags, int mode) { db_javaJNI.DbEnv_open0(swigCPtr, db_home, flags, mode); } void remove0(String db_home, int flags) { db_javaJNI.DbEnv_remove0(swigCPtr, db_home, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setCacheSize(long,int)} */ public void set_cachesize(long bytes, int ncache) throws DbException { setCacheSize(bytes, ncache); } /** * Set the size of the shared memory buffer pool -- that is, the * cache. The cache should be the size of the normal working data * set of the application, with some small amount of additional * memory for unusual situations. (Note: the working set is not * the same as the number of pages accessed simultaneously, and * is usually much larger.)

    * * The default cache size is 256KB, and may not be specified as * less than 20KB. Any cache size less than 500MB is * automatically increased by 25% to account for buffer pool * overhead; cache sizes larger than 500MB are used as specified. * The current maximum size of a single cache is 4GB. (All sizes * are in powers-of-two, that is, 256KB is 2^32 not 256,000.) For * information on tuning the Berkeley DB cache size, see Selecting a * cache size .

    * * It is possible to specify caches to Berkeley DB larger than * 4GB and/or large enough they cannot be allocated contiguously * on some architectures. For example, some releases of Solaris * limit the amount of memory that may be allocated contiguously * by a process. If ncache is 0 or 1, the cache will be * allocated contiguously in memory. If it is greater than 1, the * cache will be broken up into ncache equally sized, * separate pieces of memory.

    * * The database environment's cache size may also be set using * the environment's DB_CONFIG file. The syntax of the * entry in that file is a single line with the string * "set_cachesize", one or more whitespace characters, and the * cache size specified in three parts: the gigabytes of cache, * the additional bytes of cache, and the number of caches, also * separated by whitespace characters. For example, * "set_cachesize 2 524288000 3" would create a 2.5GB logical * cache, split between three physical caches. Because the * DB_CONFIG file is read when the database environment is * opened, it will silently overrule configuration done before * that time.

    * * The DbEnv.setCacheSize method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setCacheSize method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setCacheSize will be ignored. *

    * * @param bytes The size of the cache in * bytes. * @param ncache the number of caches to * create. * @throws IllegalArgumentException The DbEnv.setCacheSize * method will fail and throw a IllegalArgumentException * exception if the specified cache size was impossibly * small; the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setCacheSize(long bytes, int ncache) throws DbException { db_javaJNI.DbEnv_set_cachesize(swigCPtr, bytes, ncache); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setDataDir(String)} */ public void set_data_dir(String dir) throws DbException { setDataDir(dir); } /** * Set the path of a directory to be used as the location of the * access method database files. Paths specified to the {@link * com.sleepycat.db.Db#open Db.open} function will be searched * relative to this path. Paths set using this method are * additive, and specifying more than one will result in each * specified directory being searched for database files. If any * directories are specified, created database files will always * be created in the first path specified.

    * * If no database directories are specified, database files can * exist only in the environment home directory. See Berkeley DB File * Naming for more information.

    * * For the greatest degree of recoverability from system or * application failure, database files and log files should be * located on separate physical devices.

    * * The database environment's data directories may also be set * using the environment's DB_CONFIG file. The syntax of * the entry in that file is a single line with the string * "set_data_dir", one or more whitespace characters, and the * directory name.

    * * The DbEnv.setDataDir method configures operations performed * using the specified {@link com.sleepycat.db.DbEnv DbEnv} * handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setDataDir method may not be called after the {@link * com.sleepycat.db.DbEnv#open DbEnv.open} method is called. If * the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setDataDir must be consistent * with the existing environment or corruption can occur.

    * * @param dir a directory to be used as a * location for database files. * @throws IllegalArgumentException The DbEnv.setDataDir method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setDataDir(String dir) throws DbException { db_javaJNI.DbEnv_set_data_dir(swigCPtr, dir); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setEncrypted(String,int)} */ public void set_encrypt(String passwd, int flags) throws DbException { setEncrypted(passwd, flags); } /** * Set the password used by the Berkeley DB library to perform * encryption and decryption.

    * * The DbEnv.setEncrypted method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setEncrypted method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setEncrypted must be consistent * with the existing environment or an error will be returned. *

    * * @param flags must be set to 0 or the * following value: * * * @param passwd the password used to perform * encryption and decryption. * @throws DbException The DbEnv.setEncrypted * method may fail and throw {@link * com.sleepycat.db.DbException DbException}, encapsulating * one of the following non-zero errors: *
  • Cryptography is not available in this Berkeley DB * release. * @throws IllegalArgumentException The DbEnv.setEncrypted * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setEncrypted(String passwd, int flags) throws DbException { db_javaJNI.DbEnv_set_encrypt(swigCPtr, passwd, flags); } /** * When an error occurs in the Berkeley DB library, an exception * is thrown. In some cases, however, the errno value may * be insufficient to completely describe the cause of the error, * especially during initial application debugging.

    * * The DbEnv.setOnError and {@link com.sleepycat.db.Db#setErrorHandler * Db.setErrorHandler} methods are used to enhance the mechanism * for reporting error messages to the application. The * DbEnv.setOnError and {@link com.sleepycat.db.Db#setErrorHandler * Db.setErrorHandler} methods must be called with a single * object parameter. The object's class must implement the * DbErrorHandler interface.

    * * In some cases, when an error occurs, Berkeley DB will invoke * the object's errcall() method with two parameters; the first * is the prefix string (as previously set by {@link * com.sleepycat.db.Db#setErrorPrefix Db.setErrorPrefix} or * {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}), the second will be an error message * string. It is up to this method to display the message in an * appropriate manner.

    * * Alternatively, you can use the {@link * com.sleepycat.db.DbEnv#setErrorStream DbEnv.setErrorStream} * and {@link com.sleepycat.db.Db#setErrorStream * Db.setErrorStream} methods to display the additional * information via an output stream. You should not mix these * approaches.

    * * This error-logging enhancement does not slow performance or * significantly increase application size, and may be run during * normal operation as well as during application debugging.

    *

    * * The DbEnv.setOnError method may be called at any time during * the life of the application.

    * * @param db_errcall_fcn the application-specified error * reporting function. The function takes two parameters:

    * * The errpfx parameter is the prefix string (as * previously set by {@link com.sleepycat.db.Db#setErrorPrefix * Db.setErrorPrefix} or {@link * com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}).

    * * The msg parameter is the error message string. * @throws DbException Signals that an exception of some sort * has occurred. */ public void setErrorHandler(DbErrorHandler db_errcall_fcn) throws DbException { db_javaJNI.DbEnv_setErrorHandler(swigCPtr, (error_handler = db_errcall_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setFlags(int,boolean)} */ public void set_flags(int flags, boolean onoff) throws DbException { setFlags(flags, onoff); } /** * Configure a database environment.

    * * The database environment's flag values may also be set using * the environment's DB_CONFIG file. The syntax of the * entry in that file is a single line with the string * "set_flags", one or more whitespace characters, and the method * flag parameter as a string; for example, "set_flags * DB_TXN_NOSYNC". Because the DB_CONFIG file is read when * the database environment is opened, it will silently overrule * configuration done before that time.

    * * @param flags must be set by bitwise * inclusively OR 'ing together one or more of the * following values: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @param onoff If the onoff * parameter is false, the specified flags are cleared; * otherwise they are set. * @throws IllegalArgumentException The DbEnv.setFlags method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. */ public void setFlags(int flags, boolean onoff) throws DbException { db_javaJNI.DbEnv_set_flags(swigCPtr, flags, onoff); } public void setFeedbackHandler(DbEnvFeedbackHandler db_feedback_fcn) throws DbException { db_javaJNI.DbEnv_setFeedbackHandler(swigCPtr, (env_feedback_handler = db_feedback_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setMemoryPoolMapSize(long)} */ public void set_mp_mmapsize(long mp_mmapsize) throws DbException { setMemoryPoolMapSize(mp_mmapsize); } /** * Files that are opened read-only in the pool (and that satisfy * a few other criteria) are, by default, mapped into the process * address space instead of being copied into the local cache. * This can result in better-than-usual performance because * available virtual memory is normally much larger than the * local cache, and page faults are faster than page copying on * many systems. However, it can cause resource starvation in the * presence of limited virtual memory, and it can result in * immense process sizes in the presence of large databases.

    *

    * * The DbEnv.getMemoryPoolMapSize method sets the maximum file * size, in bytes, for a file to be mapped into the process * address space. If no value is specified, it defaults to 10MB. *

    * * The database environment's maximum mapped file size may also * be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_mp_mmapsize", one or more whitespace characters, * and the size in bytes. Because the DB_CONFIG file is * read when the database environment is opened, it will silently * overrule configuration done before that time.

    * * The DbEnv.setMemoryPoolMapSize method configures operations * performed using the specified {@link com.sleepycat.db.DbEnv * DbEnv} handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setMemoryPoolMapSize method may be called at any * time during the life of the application.

    * * @param mp_mmapsize the maximum file size, in * bytes, for a file to be mapped into the process address * space. * @throws IllegalArgumentException The * DbEnv.setMemoryPoolMapSize method will fail and throw a * IllegalArgumentException exception if the method was * called after {@link com.sleepycat.db.DbEnv#open * DbEnv.open} was called; or if an invalid flag value or * parameter was specified. */ public void setMemoryPoolMapSize(long mp_mmapsize) throws DbException { db_javaJNI.DbEnv_set_mp_mmapsize(swigCPtr, mp_mmapsize); } public void setPanicHandler(DbPanicHandler db_panic_fcn) throws DbException { db_javaJNI.DbEnv_setPanicHandler(swigCPtr, (panic_handler = db_panic_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setRpcServer(DbClient,String,long,long,int)} */ public void set_rpc_server(DbClient client, String host, long cl_timeout, long sv_timeout, int flags) throws DbException { setRpcServer(client, host, cl_timeout, sv_timeout, flags); } /** * Establishes a connection for this dbenv to a RPC * server.

    The DbEnv.setRpcServer method configures * operations performed using the specified {@link * com.sleepycat.db.DbEnv DbEnv} handle, not all operations * performed on the underlying database environment.

    * * The DbEnv.setRpcServer method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called.

    * * @param cl_timeout specifies the number of * seconds the client should wait for results to come back * from the server. Once the timeout has expired on any * communication with the server, Db.DB_NOSERVER will be * returned. If this value is zero, a default timeout is * used. * @param client reserved for future use. If * it is not NULL, an exception is thrown. * @param host the host to which the * Berkeley DB server will connect and create a channel for * communication. * @param flags currently unused, and must * be set to 0. * @param sv_timeout specifies the number of * seconds the server should allow a client connection to * remain idle before assuming that the client is gone. Once * that timeout has been reached, the server releases all * resources associated with that client connection. * Subsequent attempts by that client to communicate with the * server result in Db.DB_NOSERVER_ID, indicating that an * invalid identifier has been given to the server. This * value can be considered a hint to the server. The server * may alter this value based on its own policies or allowed * values. If this value is zero, a default timeout is used. * @throws IllegalArgumentException The DbEnv.setRpcServer * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. */ public void setRpcServer(DbClient client, String host, long cl_timeout, long sv_timeout, int flags) throws DbException { db_javaJNI.DbEnv_set_rpc_server(swigCPtr, client, host, cl_timeout, sv_timeout, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setSegmentId(long)} */ public void set_shm_key(long shm_key) throws DbException { setSegmentId(shm_key); } /** * Specify a base segment ID for Berkeley DB environment shared * memory regions created in system memory on VxWorks or systems * supporting X/Open-style shared memory interfaces; for example, * UNIX systems supporting shmget (2) and related System V * IPC interfaces.

    * * This base segment ID will be used when Berkeley DB shared * memory regions are first created. It will be incremented a * small integer value each time a new shared memory region is * created; that is, if the base ID is 35, the first shared * memory region created will have a segment ID of 35, and the * next one will have a segment ID between 36 and 40 or so. A * Berkeley DB environment always creates a master shared memory * region; an additional shared memory region for each of the * subsystems supported by the environment (Locking, Logging, * Memory Pool and Transaction); plus an additional shared memory * region for each additional memory pool cache that is * supported. Already existing regions with the same segment IDs * will be removed. See * Shared Memory Regions for more information.

    * * The intent behind this method is two-fold: without it, * applications have no way to ensure that two Berkeley DB * applications don't attempt to use the same segment IDs when * creating different Berkeley DB environments. In addition, by * using the same segment IDs each time the environment is * created, previously created segments will be removed, and the * set of segments on the system will not grow without bound.

    *

    * * The database environment's base segment ID may also be set * using the environment's DB_CONFIG file. The syntax of * the entry in that file is a single line with the string * "set_shm_key", one or more whitespace characters, and the ID. * Because the DB_CONFIG file is read when the database * environment is opened, it will silently overrule configuration * done before that time.

    * * The DbEnv.setSegmentId method configures operations performed * using the specified {@link com.sleepycat.db.DbEnv DbEnv} * handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setSegmentId method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setSegmentId must be consistent * with the existing environment or corruption can occur.

    * * @param shm_key the base segment ID for the * database environment. * @throws IllegalArgumentException The DbEnv.setSegmentId * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setSegmentId(long shm_key) throws DbException { db_javaJNI.DbEnv_set_shm_key(swigCPtr, shm_key); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setTestAndSetSpins(int)} */ public void set_tas_spins(int tas_spins) throws DbException { setTestAndSetSpins(tas_spins); } /** * Specify that test-and-set mutexes should spin tas_spins * times without blocking. The value defaults to 1 on * uniprocessor systems and to 50 times the number of processors * on multiprocessor systems.

    * * The database environment's test-and-set spin count may also be * set using the environment's DB_CONFIG file. The syntax * of the entry in that file is a single line with the string * "set_tas_spins", one or more whitespace characters, and the * number of spins. Because the DB_CONFIG file is read * when the database environment is opened, it will silently * overrule configuration done before that time.

    * * The DbEnv.setTestAndSetSpins method configures operations * performed using the specified {@link com.sleepycat.db.DbEnv * DbEnv} handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setTestAndSetSpins method may be called at any time * during the life of the application.

    * * @param tas_spins the number of spins * test-and-set mutexes should execute before blocking. * @throws IllegalArgumentException The DbEnv.setTestAndSetSpins * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. */ public void setTestAndSetSpins(int tas_spins) throws DbException { db_javaJNI.DbEnv_set_tas_spins(swigCPtr, tas_spins); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setTimeout(long,int)} */ public void set_timeout(long timeout, int flags) throws DbException { setTimeout(timeout, flags); } /** * The DbEnv.setTimeout method sets timeout values for locks or * transactions in the database environment.

    * * Timeouts are checked whenever a thread of control blocks on a * lock or when deadlock detection is performed. (In the case of * Db.DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly * through the Lock subsystem interfaces. In the case of * Db.DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of * a transaction. In either case, it may be a lock requested by * the database access methods underlying the application.) As * timeouts are only checked when the lock request first blocks * or when deadlock detection is performed, the accuracy of the * timeout depends on how often deadlock detection is performed. *

    * * Timeout values specified for the database environment may be * overridden on a per-lock or per-transaction basis. See {@link * com.sleepycat.db.DbEnv#lockVector DbEnv.lockVector} and {@link * com.sleepycat.db.DbTxn#setTimeout DbTxn.setTimeout} for more * information.

    * * The DbEnv.setTimeout method configures a database environment, * not only operations performed using the specified {@link * com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setTimeout method may be called at any time during * the life of the application.

    * * @param flags must be set to one of the * following values: * * * * * @param timeout the timeout value. It must * be specified as an unsigned 32-bit number of microseconds, * limiting the maximum timeout to roughly 71 minutes. * @throws IllegalArgumentException The DbEnv.setTimeout method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. */ public void setTimeout(long timeout, int flags) throws DbException { db_javaJNI.DbEnv_set_timeout(swigCPtr, timeout, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setTmpDir(String)} */ public void set_tmp_dir(String dir) throws DbException { setTmpDir(dir); } /** * Specify the path of a directory to be used as the location of * temporary files. The files created to back in-memory access * method databases will be created relative to this path. These * temporary files can be quite large, depending on the size of * the database.

    * * If no directories are specified, the following alternatives * are checked in the specified order. The first existing * directory path is used for all temporary files.

    *

      * * *

    1. The value of the environment variable TMPDIR . * *
    2. The value of the environment variable TEMP . * *
    3. The value of the environment variable TMP . *
    4. The value of the environment variable TempFolder * . *
    5. The value returned by the GetTempPath interface. *
    6. The directory /var/tmp . *
    7. The directory /usr/tmp . *
    8. The directory /temp . *
    9. The directory /tmp . *
    10. The directory C:/temp . *
    11. The directory C:/tmp . *
    *

    * * Note: environment variables are only checked if one of the * {@link com.sleepycat.db.Db#DB_USE_ENVIRON Db.DB_USE_ENVIRON} * or {@link com.sleepycat.db.Db#DB_USE_ENVIRON_ROOT * Db.DB_USE_ENVIRON_ROOT} flags were specified.

    * * Note: the GetTempPath interface is only checked on Win/32 * platforms.

    * * The database environment's temporary file directory may also * be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_tmp_dir", one or more whitespace characters, and * the directory name. Because the DB_CONFIG file is read * when the database environment is opened, it will silently * overrule configuration done before that time.

    * * The DbEnv.setTmpDir method configures operations performed * using the specified {@link com.sleepycat.db.DbEnv DbEnv} * handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setTmpDir method may not be called after the {@link * com.sleepycat.db.DbEnv#open DbEnv.open} method is called. If * the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setTmpDir must be consistent * with the existing environment or corruption can occur.

    * * @param dir the directory to be used to * store temporary files. * @throws IllegalArgumentException The DbEnv.setTmpDir method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setTmpDir(String dir) throws DbException { db_javaJNI.DbEnv_set_tmp_dir(swigCPtr, dir); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setTxnMax(int)} */ public void set_tx_max(int max) throws DbException { setTxnMax(max); } /** * Configure the Berkeley DB database environment to support at * least max active transactions. This value bounds the * size of the memory allocated for transactions. Child * transactions are counted as active until they either commit or * abort.

    * * When all of the memory available in the database environment * for transactions is in use, calls to {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin} will fail * (until some active transactions complete). If this interface * is never called, the database environment is configured to * support at least 20 active transactions.

    * * The database environment's number of active transactions may * also be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_tx_max", one or more whitespace characters, and * the number of transactions. Because the DB_CONFIG file * is read when the database environment is opened, it will * silently overrule configuration done before that time.

    * * The DbEnv.setTxnMax method configures a database environment, * not only operations performed using the specified {@link * com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setTxnMax method may not be called after the {@link * com.sleepycat.db.DbEnv#open DbEnv.open} method is called. If * the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setTxnMax will be ignored.

    * * @param max The max parameter * configures the minimum number of simultaneously active * transactions supported by Berkeley DB database * environment. * @throws IllegalArgumentException The DbEnv.setTxnMax method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setTxnMax(int max) throws DbException { db_javaJNI.DbEnv_set_tx_max(swigCPtr, max); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setAppDispatch(DbAppDispatch)} */ public void set_app_dispatch(DbAppDispatch tx_recover) throws DbException { setAppDispatch(tx_recover); } public void setAppDispatch(DbAppDispatch tx_recover) throws DbException { db_javaJNI.DbEnv_set_app_dispatch(swigCPtr, (app_dispatch_handler = tx_recover)); } void set_tx_timestamp0(long timestamp) { db_javaJNI.DbEnv_set_tx_timestamp0(swigCPtr, timestamp); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setVerbose(int,boolean)} */ public void set_verbose(int which, boolean onoff) throws DbException { setVerbose(which, onoff); } /** * The DbEnv.setVerbose method turns specific additional * informational and debugging messages in the Berkeley DB * message output on and off. To see the additional messages, * verbose messages must also be configured for the application. * For more information on verbose messages, see the {@link * com.sleepycat.db.Db#setErrorStream Db.setErrorStream} method. *

    * * The database environment's messages may also be set using the * environment's DB_CONFIG file. The syntax of the entry * in that file is a single line with the string "set_verbose", * one or more whitespace characters, and the method which * parameter as a string; for example, "set_verbose * DB_VERB_CHKPOINT". Because the DB_CONFIG file is read * when the database environment is opened, it will silently * overrule configuration done before that time.

    * * The DbEnv.setVerbose method configures operations performed * using the specified {@link com.sleepycat.db.DbEnv DbEnv} * handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setVerbose method may be called at any time during * the life of the application.

    * * @param onoff If the onoff * parameter is set to true, the additional messages are * output. * @param which must be set to one of the * following values: * * * * * * * * * * * @throws IllegalArgumentException The DbEnv.setVerbose method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. */ public void setVerbose(int which, boolean onoff) throws DbException { db_javaJNI.DbEnv_set_verbose(swigCPtr, which, onoff); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLockConflicts()} */ public byte[][] get_lk_conflicts() throws DbException { return getLockConflicts(); } /** * The DbEnv.getLockConflicts method returns the conflicts array. *

    * * The DbEnv.getLockConflicts method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLockConflicts method returns * the conflicts array.

    */ public byte[][] getLockConflicts() throws DbException { return db_javaJNI.DbEnv_get_lk_conflicts(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLockDetect()} */ public int get_lk_detect() throws DbException { return getLockDetect(); } /** * The DbEnv.getLockDetect method returns the deadlock detector * configuration.

    * * The DbEnv.getLockDetect method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLockDetect method returns * the deadlock detector configuration.

    */ public int getLockDetect() throws DbException { return db_javaJNI.DbEnv_get_lk_detect(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLockMaxLocks()} */ public int get_lk_max_locks() throws DbException { return getLockMaxLocks(); } /** * The DbEnv.setLockMaxLocks method returns the maximum number of * locks.

    * * The DbEnv.setLockMaxLocks method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.setLockMaxLocks method returns * the maximum number of locks.

    */ public int getLockMaxLocks() throws DbException { return db_javaJNI.DbEnv_get_lk_max_locks(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLockMaxLockers()} */ public int get_lk_max_lockers() throws DbException { return getLockMaxLockers(); } /** * The DbEnv.getLockMaxLockers method returns the maximum number * of lockers.

    * * The DbEnv.getLockMaxLockers method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLockMaxLockers method * returns the maximum number of lockers.

    */ public int getLockMaxLockers() throws DbException { return db_javaJNI.DbEnv_get_lk_max_lockers(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLockMaxObjects()} */ public int get_lk_max_objects() throws DbException { return getLockMaxObjects(); } /** * The DbEnv.getLockMaxObjects method returns the maximum number * of locked objects.

    * * The DbEnv.getLockMaxObjects method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLockMaxObjects method * returns the maximum number of locked objects.

    */ public int getLockMaxObjects() throws DbException { return db_javaJNI.DbEnv_get_lk_max_objects(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockDetect(int,int)} */ public int lock_detect(int flags, int atype) throws DbException { return lockDetect(flags, atype); } /** * The DbEnv.lockDetect method runs one iteration of the deadlock * detector. The deadlock detector traverses the lock table and * marks one of the participating lock requesters for rejection * in each deadlock it finds.

    * * @param atype specifies which lock * request(s) to reject. It must be set to one of the * following list: * * * * * * * * * * * * * * * * * @param flags currently unused, and must * be set to 0. * @throws IllegalArgumentException The DbEnv.lockDetect method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.lockDetect method * returns the number of lock requests that were rejected. *

    */ public int lockDetect(int flags, int atype) throws DbException { return db_javaJNI.DbEnv_lock_detect(swigCPtr, flags, atype); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockGet(int,int,Dbt,int)} */ public DbLock lock_get(int locker, int flags, Dbt object, int lock_mode) throws DbException { return lockGet(locker, flags, object, lock_mode); } /** * The DbEnv.lockGet method acquires a lock from the lock table, * returning information about it in a DbLock object.

    * * @param flags must be set to 0 or the * following value: * * * @param lock_mode used as an index into the * environment's lock conflict matrix. When using the default * lock conflict matrix, lock_mode must be set to one * of the following values: read (shared) write (exclusive) * intention to write (shared) intention to read (shared) * intention to read and write (shared)

    * * See {@link com.sleepycat.db.DbEnv#setLockConflicts * DbEnv.setLockConflicts} and Standard Lock * Modes for more information on the lock conflict * matrix.

    * @param locker an unsigned 32-bit integer * quantity. It represents the entity requesting the lock. * @param object an untyped byte string that * specifies the object to be locked. Applications using the * locking subsystem directly while also doing locking via * the Berkeley DB access methods must take care not to * inadvertently lock objects that happen to be equal to the * unique file IDs used to lock files. See Access method * locking conventions for more information. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the DbEnv.lockGet method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the DbEnv.lockGet method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws DbLockNotGrantedException If the {@link * com.sleepycat.db.Db#DB_LOCK_NOWAIT Db.DB_LOCK_NOWAIT} flag * or lock timers were configured and the lock could not be * granted before the wait-time expired, the DbEnv.lockGet * method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The DbEnv.lockGet method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @throws DbMemoryException If the maximum number of * locks has been reached, the DbEnv.lockGet method will fail * and throw a {@link com.sleepycat.db.DbMemoryException * DbMemoryException} exception. * @return The DbEnv.lockGet method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public DbLock lockGet(int locker, int flags, Dbt object, int lock_mode) throws DbException { long cPtr = db_javaJNI.DbEnv_lock_get(swigCPtr, locker, flags, object, lock_mode); return (cPtr == 0) ? null : new DbLock(cPtr, true); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockId()} */ public int lock_id() throws DbException { return lockId(); } /** * The DbEnv.lockId method returns a locker ID, which is * guaranteed to be unique in the specified lock table.

    * * The {@link com.sleepycat.db.DbEnv#lockIdFree DbEnv.lockIdFree} * method should be called to return the locker ID to the * Berkeley DB library when it is no longer needed.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.lockId method returns a locker * ID which is guaranteed to be unique in the specified lock * table.

    */ public int lockId() throws DbException { return db_javaJNI.DbEnv_lock_id(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockIdFree(int)} */ public void lock_id_free(int id) throws DbException { lockIdFree(id); } /** * The DbEnv.lockIdFree method frees a locker ID allocated by the * {@link com.sleepycat.db.DbEnv#lockId DbEnv.lockId} method.

    * * @param id the locker id to be freed. * @throws IllegalArgumentException The DbEnv.lockIdFree method * will fail and throw a IllegalArgumentException exception * if the locker ID is invalid or locks are still held by * this locker ID; or if an invalid flag value or parameter * was specified. */ public void lockIdFree(int id) throws DbException { db_javaJNI.DbEnv_lock_id_free(swigCPtr, id); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockPut(DbLock)} */ public void lock_put(DbLock lock) throws DbException { lockPut(lock); } /** * The DbEnv.lockPut method releases lock .

    * * @param lock the lock to be released. * @throws IllegalArgumentException The DbEnv.lockPut method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. */ public void lockPut(DbLock lock) throws DbException { db_javaJNI.DbEnv_lock_put(swigCPtr, DbLock.getCPtr(lock)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #lockStat(int)} */ public DbLockStat lock_stat(int flags) throws DbException { return lockStat(flags); } /** * The DbEnv.lockStat method returns the locking subsystem * statistics.

    * * The DbEnv.lockStat method creates a DbLockStat object * encapsulating the locking subsystem statistics. The following * data fields are available from the DbLockStat object:

    For * convenience, the DbLockStat class has a toString method that * lists all the data fields.

    * * @param flags must be set to 0 or the * following value: * * * @throws IllegalArgumentException The DbEnv.lockStat method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.lockStat method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public DbLockStat lockStat(int flags) throws DbException { return db_javaJNI.DbEnv_lock_stat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLockConflicts(byte[][])} */ public void set_lk_conflicts(byte[][] conflicts) throws DbException { setLockConflicts(conflicts); } /** * Set the locking conflicts matrix.

    * * If DbEnv.setLockConflicts is never called, a standard * conflicts array is used; see * Standard Lock Modes for more information.

    * * The DbEnv.setLockConflicts method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLockConflicts method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLockConflicts will be * ignored.

    * * @param conflicts the new locking conflicts * matrix. A non-0 value for the array element indicates that * requested_mode and held_mode conflict:
    conflicts[requested_mode][held_mode]
    *

    * * The not-granted mode must be represented by 0.

    * @throws IllegalArgumentException The DbEnv.setLockConflicts * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. * @throws DbMemoryException If the conflicts array could * not be copied, the DbEnv.setLockConflicts method will fail * and throw a {@link com.sleepycat.db.DbMemoryException * DbMemoryException} exception. */ public void setLockConflicts(byte[][] conflicts) throws DbException { db_javaJNI.DbEnv_set_lk_conflicts(swigCPtr, conflicts); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLockDetect(int)} */ public void set_lk_detect(int detect) throws DbException { setLockDetect(detect); } /** * Set if the deadlock detector is to be run whenever a lock * conflict occurs, and specify what lock request(s) should be * rejected. As transactions acquire locks on behalf of a single * locker ID, rejecting a lock request associated with a * transaction normally requires the transaction be aborted.

    *

    * * The database environment's deadlock detector configuration may * also be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_lk_detect", one or more whitespace characters, and * the method detect parameter as a string; for example, * "set_lk_detect DB_LOCK_OLDEST". Because the DB_CONFIG * file is read when the database environment is opened, it will * silently overrule configuration done before that time.

    * * The DbEnv.setLockDetect method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLockDetect method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLockDetect must be * consistent with the existing environment or an error will be * returned.

    * * @param detect The detect parameter * configures the deadlock detector. The specified value must * be one of the following list: * * * * * * * * * * * * * * * * * @throws IllegalArgumentException The DbEnv.setLockDetect * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLockDetect(int detect) throws DbException { db_javaJNI.DbEnv_set_lk_detect(swigCPtr, detect); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLockMaxLockers(int)} */ public void set_lk_max_lockers(int max) throws DbException { setLockMaxLockers(max); } /** * Set the maximum number of locking entities supported by the * Berkeley DB environment. This value is used by {@link * com.sleepycat.db.DbEnv#open DbEnv.open} to estimate how much * space to allocate for various lock-table data structures. The * default value is 1000 lockers. For specific information on * configuring the size of the lock subsystem, see Configuring locking: * sizing the system .

    * * The database environment's maximum number of lockers may also * be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_lk_max_lockers", one or more whitespace * characters, and the number of lockers. Because the * DB_CONFIG file is read when the database environment is * opened, it will silently overrule configuration done before * that time.

    * * The DbEnv.setLockMaxLockers method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLockMaxLockers method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLockMaxLockers will be * ignored.

    * * @param max the maximum number * simultaneous locking entities supported by the Berkeley DB * environment. * @throws IllegalArgumentException The DbEnv.setLockMaxLockers * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLockMaxLockers(int max) throws DbException { db_javaJNI.DbEnv_set_lk_max_lockers(swigCPtr, max); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLockMaxLocks(int)} */ public void set_lk_max_locks(int max) throws DbException { setLockMaxLocks(max); } /** * Set the maximum number of locks supported by the Berkeley DB * environment. This value is used by {@link * com.sleepycat.db.DbEnv#open DbEnv.open} to estimate how much * space to allocate for various lock-table data structures. The * default value is 1000 locks. For specific information on * configuring the size of the lock subsystem, see Configuring locking: * sizing the system .

    * * The database environment's maximum number of locks may also be * set using the environment's DB_CONFIG file. The syntax * of the entry in that file is a single line with the string * "set_lk_max_locks", one or more whitespace characters, and the * number of locks. Because the DB_CONFIG file is read * when the database environment is opened, it will silently * overrule configuration done before that time.

    * * The DbEnv.setLockMaxLocks method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLockMaxLocks method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLockMaxLocks will be * ignored.

    * * @param max the maximum number of locks * supported by the Berkeley DB environment. * @throws IllegalArgumentException The DbEnv.setLockMaxLocks * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLockMaxLocks(int max) throws DbException { db_javaJNI.DbEnv_set_lk_max_locks(swigCPtr, max); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLockMaxObjects(int)} */ public void set_lk_max_objects(int max) throws DbException { setLockMaxObjects(max); } /** * Set the maximum number of locked objects supported by the * Berkeley DB environment. This value is used by {@link * com.sleepycat.db.DbEnv#open DbEnv.open} to estimate how much * space to allocate for various lock-table data structures. The * default value is 1000 objects. For specific information on * configuring the size of the lock subsystem, see Configuring locking: * sizing the system .

    * * The database environment's maximum number of objects may also * be set using the environment's DB_CONFIG file. The * syntax of the entry in that file is a single line with the * string "set_lk_max_objects", one or more whitespace * characters, and the number of objects. Because the * DB_CONFIG file is read when the database environment is * opened, it will silently overrule configuration done before * that time.

    * * The DbEnv.setLockMaxObjects method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLockMaxObjects method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLockMaxObjects will be * ignored.

    * * @param max the maximum number of locked * objects supported by the Berkeley DB environment. * @throws IllegalArgumentException The DbEnv.setLockMaxObjects * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLockMaxObjects(int max) throws DbException { db_javaJNI.DbEnv_set_lk_max_objects(swigCPtr, max); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLogBufferSize()} */ public int get_lg_bsize() throws DbException { return getLogBufferSize(); } /** * The DbEnv.getLogBufferSize method returns the size of the log * buffer, in bytes.

    * * The DbEnv.getLogBufferSize method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLogBufferSize method returns * the size of the log buffer, in bytes.

    */ public int getLogBufferSize() throws DbException { return db_javaJNI.DbEnv_get_lg_bsize(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLogDir()} */ public String get_lg_dir() throws DbException { return getLogDir(); } /** * The DbEnv.getLogDir method returns the log directory.

    * * The DbEnv.getLogDir method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLogDir method returns the * log directory.

    */ public String getLogDir() throws DbException { return db_javaJNI.DbEnv_get_lg_dir(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLogMax()} */ public int get_lg_max() throws DbException { return getLogMax(); } /** * The DbEnv.getLogMax method returns the maximum log file size. *

    * * The DbEnv.getLogMax method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLogMax method returns the * maximum log file size.

    */ public int getLogMax() throws DbException { return db_javaJNI.DbEnv_get_lg_max(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getLogRegionMax()} */ public int get_lg_regionmax() throws DbException { return getLogRegionMax(); } /** * The DbEnv.getLogRegionMax method returns the size of the * underlying logging subsystem region.

    * * The DbEnv.getLogRegionMax method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getLogRegionMax method returns * the size of the underlying logging subsystem region.

    */ public int getLogRegionMax() throws DbException { return db_javaJNI.DbEnv_get_lg_regionmax(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logArchive(int)} */ public String[] log_archive(int flags) throws DbException { return logArchive(flags); } /** * The DbEnv.logArchive method returns an array of log or * database filenames.

    * * By default, DbEnv.logArchive returns the names of all of the * log files that are no longer in use (for example, that are no * longer involved in active transactions), and that may safely * be archived for catastrophic recovery and then removed from * the system. If there are no filenames to return, * DbEnv.logArchive returns null.

    * * Log cursor handles (returned by the {@link * com.sleepycat.db.DbEnv#logCursor DbEnv.logCursor} method) may * have open file descriptors for log files in the database * environment. Also, the Berkeley DB interfaces to the database * environment logging subsystem (for example, {@link * com.sleepycat.db.DbEnv#logPut DbEnv.logPut} and {@link * com.sleepycat.db.DbTxn#abort DbTxn.abort}) may allocate log * cursors and have open file descriptors for log files as well. * On operating systems where filesystem related system calls * (for example, rename and unlink on Windows/NT) can fail if a * process has an open file descriptor for the affected file, * attempting to move or remove the log files listed by * DbEnv.logArchive may fail. All Berkeley DB internal use of log * cursors operates on active log files only and furthermore, is * short-lived in nature. So, an application seeing such a * failure should be restructured to close any open log cursors * it may have, and otherwise to retry the operation until it * succeeds. (Although the latter is not likely to be necessary; * it is hard to imagine a reason to move or rename a log file in * which transactions are being logged or aborted.)

    * * See db_archive * for more information on database archival procedures.

    * * @param flags must be set to 0 or by * bitwise inclusively OR 'ing together one or more of * the following values: * * * * * * * * * @throws IllegalArgumentException The DbEnv.logArchive method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.logArchive method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public String[] logArchive(int flags) throws DbException { return db_javaJNI.DbEnv_log_archive(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logCompare(DbLsn,DbLsn)} */ public static int log_compare(DbLsn lsn0, DbLsn lsn1) { return logCompare(lsn0, lsn1); } /** * The DbEnv.logCompare method allows the caller to compare two * {@link com.sleepycat.db.DbLsn DbLsn} objects, returning 0 if * they are equal, 1 if lsn0 is greater than lsn1 , * and -1 if lsn0 is less than lsn1 .

    * * @param lsn0 one of the {@link com.sleepycat.db.DbLsn DbLsn} * objects to be compared. * @param lsn1 one of the {@link com.sleepycat.db.DbLsn DbLsn} * objects to be compared. * @return The DbEnv.logCompare method returns 0 if the * {@link com.sleepycat.db.DbLsn DbLsn} object parameters are * equal, 1 if lsn0 is greater than lsn1 , and * -1 if lsn0 is less than lsn1 .

    */ public static int logCompare(DbLsn lsn0, DbLsn lsn1) { return db_javaJNI.DbEnv_log_compare(DbLsn.getCPtr(lsn0), DbLsn.getCPtr(lsn1)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logCursor(int)} */ public DbLogc log_cursor(int flags) throws DbException { return logCursor(flags); } /** * The DbEnv.logCursor method returns a created log cursor.

    * * @param flags currently unused, and must * be set to 0. * @throws IllegalArgumentException The DbEnv.logCursor method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.logCursor method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public DbLogc logCursor(int flags) throws DbException { long cPtr = db_javaJNI.DbEnv_log_cursor(swigCPtr, flags); return (cPtr == 0) ? null : new DbLogc(cPtr, true); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logFile(DbLsn)} */ public String log_file(DbLsn lsn) throws DbException { return logFile(lsn); } /** * The DbEnv.logFile method maps {@link com.sleepycat.db.DbLsn * DbLsn} objects to filenames, returning the name of the file * containing the record named by lsn .

    * * This mapping of {@link com.sleepycat.db.DbLsn DbLsn} objects * to files is needed for database administration. For example, a * transaction manager typically records the earliest {@link * com.sleepycat.db.DbLsn DbLsn} needed for restart, and the * database administrator may want to archive log files to tape * when they contain only {@link com.sleepycat.db.DbLsn DbLsn} * entries before the earliest one needed for restart.

    * * @param lsn the {@link com.sleepycat.db.DbLsn * DbLsn} object for which a filename is wanted. * @throws DbMemoryException If the supplied buffer was too * small to hold the log filename, the DbEnv.logFile method * will fail and throw a {@link * com.sleepycat.db.DbMemoryException DbMemoryException} * exception. * @return The DbEnv.logFile method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public String logFile(DbLsn lsn) throws DbException { return db_javaJNI.DbEnv_log_file(swigCPtr, DbLsn.getCPtr(lsn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logFlush(DbLsn)} */ public void log_flush(DbLsn lsn) throws DbException { logFlush(lsn); } /** * The DbEnv.logFlush method writes log records to disk.

    * * @param lsn All log records with {@link * com.sleepycat.db.DbLsn DbLsn} values less than or equal to * the lsn parameter are written to disk. If lsn * is null, all records in the log are flushed. * @throws IllegalArgumentException The DbEnv.logFlush method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. */ public void logFlush(DbLsn lsn) throws DbException { db_javaJNI.DbEnv_log_flush(swigCPtr, DbLsn.getCPtr(lsn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logPut(DbLsn,Dbt,int)} */ public void log_put(DbLsn lsn, Dbt data, int flags) throws DbException { logPut(lsn, data, flags); } /** * The DbEnv.logPut method appends records to the log. The {@link * com.sleepycat.db.DbLsn DbLsn} of the put record is returned in * the lsn parameter.

    * * @param data the record to write to the * log.

    * * The caller is responsible for providing any necessary * structure to data . (For example, in a write-ahead * logging protocol, the application must understand what * part of data is an operation code, what part is * redo information, and what part is undo information. In * addition, most transaction managers will store in data * the {@link com.sleepycat.db.DbLsn DbLsn} of the * previous log record for the same transaction, to support * chaining back through the transaction's log records during * undo.)

    * @param flags must be set to 0 or the * following value: * * * @param lsn references memory into which * the {@link com.sleepycat.db.DbLsn DbLsn} of the put record * is copied. * @throws IllegalArgumentException The {@link * com.sleepycat.db.DbEnv#logFlush DbEnv.logFlush} method * will fail and throw a IllegalArgumentException exception * if the record to be logged is larger than the maximum log * record; or if an invalid flag value or parameter was * specified. */ public void logPut(DbLsn lsn, Dbt data, int flags) throws DbException { db_javaJNI.DbEnv_log_put(swigCPtr, DbLsn.getCPtr(lsn), data, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #logStat(int)} */ public DbLogStat log_stat(int flags) throws DbException { return logStat(flags); } /** * The DbEnv.logStat method returns the logging subsystem * statistics.

    * * The DbEnv.logStat method creates a DbLogStat object * encapsulating the logging subsystem statistics. The following * data fields are available from the DbLogStat object:

    For * convenience, the DbLogStat class has a toString method that * lists all the data fields.

    * * @param flags must be set to 0 or the * following value: * * * @throws IllegalArgumentException The DbEnv.logStat method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.logStat method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public DbLogStat logStat(int flags) throws DbException { return db_javaJNI.DbEnv_log_stat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLogBufferSize(int)} */ public void set_lg_bsize(int lg_bsize) throws DbException { setLogBufferSize(lg_bsize); } /** * Set the size of the in-memory log buffer, in bytes. By * default, or if the value is set to 0, a size of 32K is used. * The size of the log file (see {@link * com.sleepycat.db.DbEnv#setLogMax DbEnv.setLogMax}) must be at * least four times the size of the in-memory log buffer.

    * * Log information is stored in-memory until the storage space * fills up or transaction commit forces the information to be * flushed to stable storage. In the presence of long-running * transactions or transactions producing large amounts of data, * larger buffer sizes can increase throughput.

    * * The database environment's log buffer size may also be set * using the environment's DB_CONFIG file. The syntax of * the entry in that file is a single line with the string * "set_lg_bsize", one or more whitespace characters, and the * size in bytes. Because the DB_CONFIG file is read when * the database environment is opened, it will silently overrule * configuration done before that time.

    * * The DbEnv.setLogBufferSize method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLogBufferSize method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLogBufferSize will be * ignored.

    * * @param lg_bsize the size of the in-memory * log buffer, in bytes. * @throws IllegalArgumentException The DbEnv.setLogBufferSize * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; The * size of the log file is less than four times the size of * the in-memory log buffer; or if an invalid flag value or * parameter was specified. */ public void setLogBufferSize(int lg_bsize) throws DbException { db_javaJNI.DbEnv_set_lg_bsize(swigCPtr, lg_bsize); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLogDir(String)} */ public void set_lg_dir(String dir) throws DbException { setLogDir(dir); } /** * The path of a directory to be used as the location of logging * files. Log files created by the Log Manager subsystem will be * created in this directory.

    * * If no logging directory is specified, log files are created in * the environment home directory. See Berkeley DB File * Naming for more information.

    * * For the greatest degree of recoverability from system or * application failure, database files and log files should be * located on separate physical devices.

    * * The database environment's logging directory may also be set * using the environment's DB_CONFIG file. The syntax of * the entry in that file is a single line with the string * "set_lg_dir", one or more whitespace characters, and the * directory name. Because the DB_CONFIG file is read when * the database environment is opened, it will silently overrule * configuration done before that time.

    * * The DbEnv.setLogDir method configures operations performed * using the specified {@link com.sleepycat.db.DbEnv DbEnv} * handle, not all operations performed on the underlying * database environment.

    * * The DbEnv.setLogDir method may not be called after the {@link * com.sleepycat.db.DbEnv#open DbEnv.open} method is called. If * the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLogDir must be consistent * with the existing environment or corruption can occur.

    * * @param dir the directory used to store * the logging files. * @throws IllegalArgumentException The DbEnv.setLogDir method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLogDir(String dir) throws DbException { db_javaJNI.DbEnv_set_lg_dir(swigCPtr, dir); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLogMax(int)} */ public void set_lg_max(int lg_max) throws DbException { setLogMax(lg_max); } /** * Set the maximum size of a single file in the log, in bytes. By * default, or if the lg_max parameter is set to 0, a size * of 10MB is used. Because {@link com.sleepycat.db.DbLsn DbLsn} * file offsets are unsigned four-byte values, the set value may * not be larger than the maximum unsigned four-byte value. The * size of the log file must be at least four times the size of * the in-memory log buffer (see {@link * com.sleepycat.db.DbEnv#setLogBufferSize * DbEnv.setLogBufferSize}).

    * * See Log File * Limits for more information.

    * * The database environment's log file size may also be set using * the environment's DB_CONFIG file. The syntax of the * entry in that file is a single line with the string * "set_lg_max", one or more whitespace characters, and the size * in bytes. Because the DB_CONFIG file is read when the * database environment is opened, it will silently overrule * configuration done before that time.

    * * The DbEnv.setLogMax method configures a database environment, * not only operations performed using the specified {@link * com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLogMax method may be called at any time during * the life of the application.

    If no size is specified by * the application, the size last specified for the database * region will be used, or if no database region previously * existed, the default will be used. * * @param lg_max the size of a single log * file, in bytes. * @throws IllegalArgumentException The DbEnv.setLogMax method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; the * size of the log file is less than four times the size of * the in-memory log buffer; The specified log file size was * too large; or if an invalid flag value or parameter was * specified. */ public void setLogMax(int lg_max) throws DbException { db_javaJNI.DbEnv_set_lg_max(swigCPtr, lg_max); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setLogRegionMax(int)} */ public void set_lg_regionmax(int lg_regionmax) throws DbException { setLogRegionMax(lg_regionmax); } /** * Set the size of the underlying logging area of the Berkeley DB * environment, in bytes. By default, or if the value is set to * 0, the default size is 60KB. The log region is used to store * filenames, and so may need to be increased in size if a large * number of files will be opened and registered with the * specified Berkeley DB environment's log manager.

    * * The database environment's log region size may also be set * using the environment's DB_CONFIG file. The syntax of * the entry in that file is a single line with the string * "set_lg_regionmax", one or more whitespace characters, and the * size in bytes. Because the DB_CONFIG file is read when * the database environment is opened, it will silently overrule * configuration done before that time.

    * * The DbEnv.setLogRegionMax method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setLogRegionMax method may not be called after the * {@link com.sleepycat.db.DbEnv#open DbEnv.open} method is * called. If the database environment already exists when {@link * com.sleepycat.db.DbEnv#open DbEnv.open} is called, the * information specified to DbEnv.setLogRegionMax will be * ignored.

    * * @param lg_regionmax the size of the logging area * in the Berkeley DB environment, in bytes. * @throws IllegalArgumentException The DbEnv.setLogRegionMax * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.DbEnv#open DbEnv.open} was called; or if * an invalid flag value or parameter was specified. */ public void setLogRegionMax(int lg_regionmax) throws DbException { db_javaJNI.DbEnv_set_lg_regionmax(swigCPtr, lg_regionmax); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getCacheSize()} */ public long get_cachesize() throws DbException { return getCacheSize(); } /** * The DbEnv.getCacheSize method returns the size of the cache. *

    * * The DbEnv.getCacheSize method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getCacheSize method returns the * size of the cache.

    */ public long getCacheSize() throws DbException { return db_javaJNI.DbEnv_get_cachesize(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getCacheSizeNcache()} */ public int get_cachesize_ncache() throws DbException { return getCacheSizeNcache(); } /** * The DbEnv.getCacheSizeNcache method returns the number of * caches.

    * * The DbEnv.getCacheSizeNcache method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getCacheSizeNcache method * returns the number of caches.

    */ public int getCacheSizeNcache() throws DbException { return db_javaJNI.DbEnv_get_cachesize_ncache(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getMemoryPoolMapSize()} */ public long get_mp_mmapsize() throws DbException { return getMemoryPoolMapSize(); } /** * The DbEnv.getMemoryPoolMapSize method returns the maximum file * map size.

    * * The DbEnv.getMemoryPoolMapSize method may be called at any * time during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getMemoryPoolMapSize method * returns the maximum file map size.

    */ public long getMemoryPoolMapSize() throws DbException { return db_javaJNI.DbEnv_get_mp_mmapsize(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #memoryPoolStat(int)} */ public DbMpoolStat memp_stat(int flags) throws DbException { return memoryPoolStat(flags); } /** * The DbEnv.memoryPoolStat method returns the memory pool (that * is, the buffer cache) subsystem statistics.

    * * The DbEnv.memoryPoolStat method creates a DbMpoolStat object * encapsulating memory pool (that is, the buffer cache) * statistics. The following data fields are available from the * DbMpoolStat object:

    For convenience, the DbMpoolStat class * has a toString method that lists all the data fields.

    * * @param flags must be set to 0 or the following value: * * * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.memoryPoolStat method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public DbMpoolStat memoryPoolStat(int flags) throws DbException { return db_javaJNI.DbEnv_memp_stat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #memoryPoolFileStat(int)} */ public DbMpoolFStat[] memp_fstat(int flags) throws DbException { return memoryPoolFileStat(flags); } /** * The DbEnv.memoryPoolFileStat method creates an array of * DbMpoolFStat objects containing statistics for individual * files in the cache. Each DbMpoolFStat object contains * statistics for an individual DbMpoolFile. The following data * fields are available for each DbMpoolFStat object:

    For * convenience, the DbMpoolFStat class has a toString method that * lists all the data fields.

    * * @param flags must be set to 0 or the * following value: * * * @throws IllegalArgumentException The DbEnv.memoryPoolStat * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. * @return The DbEnv.memoryPoolFileStat * method throws an exception that encapsulates a non-zero * error value on failure.

    */ public DbMpoolFStat[] memoryPoolFileStat(int flags) throws DbException { return db_javaJNI.DbEnv_memp_fstat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #memoryPoolTrickle(int)} */ public int memp_trickle(int percent) throws DbException { return memoryPoolTrickle(percent); } /** * The DbEnv.memoryPoolTrickle method ensures that a specified * percent of the pages in the shared memory pool are clean, by * writing dirty pages to their backing files.

    * * The purpose of the DbEnv.memoryPoolTrickle function is to * enable a memory pool manager to ensure that a page is always * available for reading in new information without having to * wait for a write.

    * * @param nwrotep references memory into which * the number of pages written to reach the specified * percentage is copied. * @param percent the percent of the pages in * the cache that should be clean. * @throws IllegalArgumentException The DbEnv.memoryPoolTrickle * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. * @return The DbEnv.memoryPoolTrickle * method returns the number of pages that were written to * reach the specified percentage. */ public int memoryPoolTrickle(int percent) throws DbException { return db_javaJNI.DbEnv_memp_trickle(swigCPtr, percent); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getTxnMax()} */ public int get_tx_max() throws DbException { return getTxnMax(); } /** * The DbEnv.getTxnMax method returns the number of active * transactions.

    * * The DbEnv.getTxnMax method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getTxnMax method returns the * number of active transactions.

    */ public int getTxnMax() throws DbException { return db_javaJNI.DbEnv_get_tx_max(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getTxnTimestamp()} */ public long get_tx_timestamp() throws DbException { return getTxnTimestamp(); } /** * The DbEnv.getTxnTimestamp method returns the recovery * timestamp.

    * * The DbEnv.getTxnTimestamp method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getTxnTimestamp method returns * the recovery timestamp.

    */ public long getTxnTimestamp() throws DbException { return db_javaJNI.DbEnv_get_tx_timestamp(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getTimeout(int)} */ public long get_timeout(int flag) throws DbException { return getTimeout(flag); } /** * The DbEnv.getTimeout method returns a timeout value, in * microseconds.

    * * The DbEnv.getTimeout method may be called at any time during * the life of the application.

    * * @param flag must be set to one of the following * values: * * * * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getTimeout method returns a * timeout value, in microseconds.

    */ public long getTimeout(int flag) throws DbException { return db_javaJNI.DbEnv_get_timeout(swigCPtr, flag); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #txnBegin(DbTxn,int)} */ public DbTxn txn_begin(DbTxn parent, int flags) throws DbException { return txnBegin(parent, flags); } /** * The DbEnv.txnBegin method creates a new transaction in the * environment and returns a {@link com.sleepycat.db.DbTxn DbTxn} * that uniquely identifies it. Calling the {@link * com.sleepycat.db.DbTxn#abort DbTxn.abort}, {@link * com.sleepycat.db.DbTxn#commit DbTxn.commit} or {@link * com.sleepycat.db.DbTxn#discard DbTxn.discard} methods will * discard the returned handle.

    * * Note: Transactions may only span threads if they do so * serially; that is, each transaction must be active in only a * single thread of control at a time. This restriction holds for * parents of nested transactions as well; not two children may * be concurrently active in more than one thread of control at * any one time.

    * * Note: Cursors may not span transactions; that is, each * cursor must be opened and closed within a single transaction. *

    * * Note: A parent transaction may not issue any Berkeley DB * operations -- except for DbEnv.txnBegin, {@link * com.sleepycat.db.DbTxn#abort DbTxn.abort} and {@link * com.sleepycat.db.DbTxn#commit DbTxn.commit} -- while it has * active child transactions (child transactions that have not * yet been committed or aborted).

    * * @param flags must be set to 0 or by bitwise * inclusively OR 'ing together one or more of the * following values: * * * * * * * * * @param parent If the parent parameter is * non-null, the new transaction will be a nested * transaction, with the transaction indicated by parent * as its parent. Transactions may be nested to any * level. In the presence of distributed transactions and * two-phase commit, only the parental transaction, that is a * transaction without a parent specified, should be * passed as an parameter to {@link * com.sleepycat.db.DbTxn#prepare DbTxn.prepare}. * @throws DbMemoryException If the maximum number of concurrent * transactions has been reached, the DbEnv.txnBegin method * will fail and throw a {@link * com.sleepycat.db.DbMemoryException DbMemoryException} * exception. * @return The DbEnv.txnBegin method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public DbTxn txnBegin(DbTxn parent, int flags) throws DbException { long cPtr = db_javaJNI.DbEnv_txn_begin(swigCPtr, DbTxn.getCPtr(parent), flags); return (cPtr == 0) ? null : new DbTxn(cPtr, false); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #txnCheckpoint(int,int,int)} */ public void txn_checkpoint(int kbyte, int min, int flags) throws DbException { txnCheckpoint(kbyte, min, flags); } /** * The DbEnv.txnCheckpoint method flushes the underlying memory * pool, writes a checkpoint record to the log, and then flushes * the log.

    * * @param flags must be set to 0 or the * following value: * * * @param kbyte If the kbyte * parameter is non-zero, a checkpoint will be done if more * than kbyte kilobytes of log data have been written * since the last checkpoint. * @param min If the min parameter * is non-zero, a checkpoint will be done if more than min * minutes have passed since the last checkpoint. * @throws IllegalArgumentException The DbEnv.txnCheckpoint * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. */ public void txnCheckpoint(int kbyte, int min, int flags) throws DbException { db_javaJNI.DbEnv_txn_checkpoint(swigCPtr, kbyte, min, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #txnRecover(int,int)} */ public DbPreplist[] txn_recover(int count, int flags) throws DbException { return txnRecover(count, flags); } /** * The DbEnv.txnRecover method returns a list of prepared but not * yet resolved transactions. The DbEnv.txnRecover method should * only be called after the environment has been recovered. * Because database environment state must be preserved between * recovery and the application calling DbEnv.txnRecover, * applications must either call DbEnv.txnRecover using the same * environment handle used when recovery is done, or the database * environment must not be configured using the {@link * com.sleepycat.db.Db#DB_PRIVATE Db.DB_PRIVATE} flag.

    * * The DbEnv.txnRecover method returns a list of transactions * that must be resolved by the application (committed, aborted * or discarded). The return value is an array of objects of type * DbPreplist; the following DbPreplist fields will be filled in: *

    The application must call {@link * com.sleepycat.db.DbTxn#abort DbTxn.abort}, {@link * com.sleepycat.db.DbTxn#commit DbTxn.commit} or {@link * com.sleepycat.db.DbTxn#discard DbTxn.discard} on each returned * {@link com.sleepycat.db.DbTxn DbTxn} handle before starting * any new operations.

    * * @param count specifies the number of maximum size of * the array that should be returned. * @param flags must be set to one of the following * values: * * * * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.txnRecover method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public DbPreplist[] txnRecover(int count, int flags) throws DbException { return db_javaJNI.DbEnv_txn_recover(swigCPtr, count, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #txnStat(int)} */ public DbTxnStat txn_stat(int flags) throws DbException { return txnStat(flags); } /** * The DbEnv.txnStat method returns the transaction subsystem * statistics.

    * * The DbEnv.txnStat method creates a DbTxnStat object * encapsulating the transaction subsystem statistics. The * following data fields are available from the DbTxnStat object: *

    For convenience, the DbTxnStat class has a toString * method that lists all the data fields.

    * * @param flags must be set to 0 or the * following value: * * * @throws IllegalArgumentException The DbEnv.txnStat method * will fail and throw a IllegalArgumentException exception * if an invalid flag value or parameter was specified. * @return The DbEnv.txnStat method * throws an exception that encapsulates a non-zero error * value on failure.

    */ public DbTxnStat txnStat(int flags) throws DbException { return db_javaJNI.DbEnv_txn_stat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getReplicationLimit()} */ public long get_rep_limit() throws DbException { return getReplicationLimit(); } /** * The DbEnv.getReplicationLimit method returns the transmit * limit in bytes.

    * * The DbEnv.getReplicationLimit method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getReplicationLimit method * returns the transmit limit in bytes.

    */ public long getReplicationLimit() throws DbException { return db_javaJNI.DbEnv_get_rep_limit(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #replicationElect(int,int,int)} */ public int rep_elect(int nsites, int priority, int timeout) throws DbException { return replicationElect(nsites, priority, timeout); } /** * The DbEnv.replicationElect method holds an election for the * master of a replication group.

    * * If the election is successful, the new master's ID may be the * ID of the previous master, or the ID of the current * environment. The application is responsible for adjusting its * usage of the other environments in the replication group, * including directing all database updates to the newly selected * master, in accordance with the results of this election.

    *

    * * The thread of control that calls the DbEnv.replicationElect * method must not be the thread of control that processes * incoming messages; processing the incoming messages is * necessary to successfully complete an election.

    * * @param nsites The nsites parameter indicates the * number of environments that the application believes are * in the replication group. This number is used by Berkeley * DB to avoid having two masters active simultaneously, even * in the case of a network partition. During an election, a * new master cannot be elected unless more than half of * nsites agree on the new master. Thus, in the face of a * network partition, the side of the partition with more * than half the environments will elect a new master and * continue, while the environments communicating with fewer * than half the other environments will fail to find a new * master. * @param priority the priority of this environment. It must * be a positive integer, or 0 if this environment is not * permitted to become a master (see Replication * environment priorities for more information). * @param timeout specifies a timeout period for an * election. If the election has not completed after * timeout microseconds, the election will fail. * @throws DbException The DbEnv.replicationElect method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • The replication group was unable to elect a master, * or was unable to complete the election in the specified * timeout period. * @return The DbEnv.replicationElect method returns * the newly elected master's ID. */ public int replicationElect(int nsites, int priority, int timeout) throws DbException { return db_javaJNI.DbEnv_rep_elect(swigCPtr, nsites, priority, timeout); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #replicationProcessMessage(Dbt,Dbt,DbEnv.RepProcessMessage,DbLsn)} */ public int rep_process_message(Dbt control, Dbt rec, DbEnv.RepProcessMessage envid, DbLsn ret_lsn) throws DbException { return replicationProcessMessage(control, rec, envid, ret_lsn); } /** * The DbEnv.replicationProcessMessage method processes an * incoming replication message sent by a member of the * replication group to the local database environment.

    * * For implementation reasons, all incoming replication messages * must be processed using the same {@link com.sleepycat.db.DbEnv * DbEnv} handle. It is not required that a single thread of * control process all messages, only that all threads of control * processing messages use the same handle.

    * * The DbEnv.replicationProcessMessage method has additional * return values:

    * * @param control The control parameter should * reference a copy of the control parameter specified * by Berkeley DB on the sending environment. * @param envid The envid parameter should contain * the local identifier that corresponds to the environment * that sent the message to be processed (see Replication * environment IDs for more information). * @param rec The rec parameter should reference * a copy of the rec parameter specified by Berkeley * DB on the sending environment. * @param ret_lsn If DbEnv.replicationProcessMessage method * returns Db.DB_REP_NOTPERM then the ret_lsn * parameter will contain the log sequence number of this * permanent log message that could not be written to disk. * If DbEnv.replicationProcessMessage method returns * Db.DB_REP_ISPERM then the ret_lsn parameter will * contain largest log sequence number of the permanent * records that are now written to disk as a result of * processing this message. In all other cases the value of * ret_lsn is undefined. * @throws DbException Signals that an exception of some sort * has occurred. * @return * * The application should reconfigure itself as a client by * calling the {@link com.sleepycat.db.DbEnv#replicationStart * DbEnv.replicationStart} method, and then call for an * election by calling {@link com.sleepycat.db.DbEnv#replicationElect * DbEnv.replicationElect}.

    * * The application should call for an election by calling * {@link com.sleepycat.db.DbEnv#replicationElect * DbEnv.replicationElect}.

    * * The maximum LSN of the permanent records stored is * returned.

    * * The envid parameter contains the environment ID of * the new master. If the recipient of this error return has * been made master, it is the application's responsibility * to begin acting as the master environment.

    * * The rec parameter contains the opaque data * specified in the cdata parameter to the {@link * com.sleepycat.db.DbEnv#replicationStart * DbEnv.replicationStart}. The application should take * whatever action is needed to establish a communication * channel with this new environment.

    * * The LSN of this record is returned. The application should * take whatever action is deemed necessary to retain its * recoverability characteristics.

    * * The application should copy over a hot backup of the * environment, run recovery, and restart the client.

    * Unless otherwise specified, the * DbEnv.replicationProcessMessage method throws an exception * that encapsulates a non-zero error value on failure.

    */ public int replicationProcessMessage(Dbt control, Dbt rec, DbEnv.RepProcessMessage envid, DbLsn ret_lsn) throws DbException { return db_javaJNI.DbEnv_rep_process_message(swigCPtr, control, rec, envid, DbLsn.getCPtr(ret_lsn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #replicationStart(Dbt,int)} */ public void rep_start(Dbt cdata, int flags) throws DbException { replicationStart(cdata, flags); } /** * The DbEnv.replicationStart method configures the database * environment as a client or master in a group of replicated * database environments. Replication master environments are the * only database environments where replicated databases may be * modified. Replication client environments are read-only as * long as they are clients. Replication client environments may * be upgraded to be replication master environments in the case * that the current master fails or there is no master present. *

    * * The enclosing database environment must already have been * opened by calling the {@link com.sleepycat.db.DbEnv#open * DbEnv.open} method and must already have been configured to * send replication messages by calling the {@link * com.sleepycat.db.DbEnv#setReplicationTransport * DbEnv.setReplicationTransport} method.

    * * @param cdata an opaque data item that is * sent over the communication infrastructure when the client * or master comes online (see Connecting to a * new site for more information). If no such information * is useful, cdata should be null. * @param flags must be set to one of the * following values: * * * * * * * @throws IllegalArgumentException The DbEnv.replicationStart * method will fail and throw a IllegalArgumentException * exception if the database environment was not already * configured to communicate with a replication group by a * call to {@link com.sleepycat.db.DbEnv#setReplicationTransport * DbEnv.setReplicationTransport}; the database environment * was not already opened; or if an invalid flag value or * parameter was specified. */ public void replicationStart(Dbt cdata, int flags) throws DbException { db_javaJNI.DbEnv_rep_start(swigCPtr, cdata, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #replicationStat(int)} */ public DbRepStat rep_stat(int flags) throws DbException { return replicationStat(flags); } /** * The DbEnv.replicationStat method returns the replication * subsystem statistics.

    * * The DbEnv.replicationStat method creates a DbRepStat object * encapsulating the replication subsystem statistics. The * following data fields are available from the DbRepStat object: *

    For convenience, the DbRepStat class has a toString * method that lists all the data fields.

    * * @param flags must be set to 0 or the * following value: * * * @throws IllegalArgumentException The DbEnv.replicationStat * method will fail and throw a IllegalArgumentException * exception if an invalid flag value or parameter was * specified. * @return The DbEnv.replicationStat * method throws an exception that encapsulates a non-zero * error value on failure.

    */ public DbRepStat replicationStat(int flags) throws DbException { return db_javaJNI.DbEnv_rep_stat(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setReplicationLimit(long)} */ public void set_rep_limit(long bytes) throws DbException { setReplicationLimit(bytes); } /** * The DbEnv.setReplicationLimit method imposes a byte-count * limit on the amount of data that will be transmitted from a * site in a single call to {@link com.sleepycat.db.DbEnv#replicationProcessMessage * DbEnv.replicationProcessMessage} method.

    * * The DbEnv.setReplicationLimit method configures a database * environment, not only operations performed using the specified * {@link com.sleepycat.db.DbEnv DbEnv} handle.

    * * The DbEnv.setReplicationLimit method may not be called before * the {@link com.sleepycat.db.DbEnv#open DbEnv.open} method has * been called.

    * * @param bytes specifies the maximum number of bytes * that will be sent in a single call to {@link * com.sleepycat.db.DbEnv#replicationProcessMessage * DbEnv.replicationProcessMessage} method. * @throws DbException Signals that an exception of some sort * has occurred. */ public void setReplicationLimit(long bytes) throws DbException { db_javaJNI.DbEnv_set_rep_limit(swigCPtr, bytes); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setReplicationTransport(int,DbRepTransport)} */ public void set_rep_transport(int envid, DbRepTransport send) throws DbException { setReplicationTransport(envid, send); } public void setReplicationTransport(int envid, DbRepTransport send) throws DbException { db_javaJNI.DbEnv_set_rep_transport(swigCPtr, envid, (rep_transport_handler = send)); } /** * The DbEnv.strerror method returns an error message string * corresponding to the error number error parameter.

    *

    * * This function is a superset of the ANSI C X3.159-1989 (ANSI C) * strerror (3) function. If the error number error * is greater than or equal to 0, then the string returned by the * system function strerror (3) is returned. If the error * number is less than 0, an error string appropriate to the * corresponding Berkeley DB library error is returned. See Error returns * to applications for more information.

    * * @param error the error number for which an error message * string is wanted. * @return The DbEnv.strerror method returns an error * message string corresponding to the error number error * parameter.

    */ public static String strerror(int error) { return db_javaJNI.DbEnv_strerror(error); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getVersionMajor()} */ public static int get_version_major() { return getVersionMajor(); } /** * The DbEnv.getVersionMajor method returns the release major * number.

    * * The DbEnv.getVersionMajor method may be called at any time * during the life of the application.

    * * @return The DbEnv.getVersionMajor method returns the release * major number.

    */ public static int getVersionMajor() { return db_javaJNI.DbEnv_get_version_major(); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getVersionMinor()} */ public static int get_version_minor() { return getVersionMinor(); } /** * The DbEnv.getVersionMinor method returns the release minor * number.

    * * The DbEnv.getVersionMinor method may be called at any time * during the life of the application.

    * * @return The DbEnv.getVersionMinor method returns the release * minor number.

    */ public static int getVersionMinor() { return db_javaJNI.DbEnv_get_version_minor(); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getVersionPatch()} */ public static int get_version_patch() { return getVersionPatch(); } /** * The DbEnv.getVersionPatch method returns the release patch * number.

    * * The DbEnv.getVersionPatch method may be called at any time * during the life of the application.

    * * @return The DbEnv.getVersionPatch method returns the release * patch number.

    */ public static int getVersionPatch() { return db_javaJNI.DbEnv_get_version_patch(); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getVersionString()} */ public static String get_version_string() { return getVersionString(); } /** * The DbEnv.getVersionString method returns the release verbose * version information, suitable for display.

    * * The DbEnv.getVersionString method may be called at any time * during the life of the application.

    * * @return The DbEnv.getVersionString method returns the * release verbose version information, suitable for display. *

    */ public static String getVersionString() { return db_javaJNI.DbEnv_get_version_string(); } }