# DbEnv.lock_stat |

`

###

    import com.sleepycat.db.*;

    public DbLockStat lock_stat()
    	throws DbException;

# Description

The DbEnv.lock_stat method creates a DbLockStat object encapsulating a statistical structure. The lock region statistics are stored in a DbLockStat object. The following data fields are available from the DbLockStat object:

Statistical structures are created in allocated memory. If db_malloc is non-NULL, it is called to allocate the memory, otherwise, the library function malloc(3) is used. The function db_malloc must match the calling conventions of the malloc(3) library routine. Regardless, the caller is responsible for deallocating the returned memory. To deallocate returned memory, free the returned memory reference, references inside the returned memory do not need to be individually freed.

The lock region statistics are stored in a structure of type DB_LOCK_STAT. The following DB_LOCK_STAT fields will be filled in:

public int st_lastid;
  The last allocated lock ID.
public int st_nmodes;
  The number of lock modes.
public int st_maxlocks;
  The maximum number of locks possible.
public int st_maxlockers;
  The maximum number of lockers possible.
public int st_maxobjects;
  The maximum number of objects possible.
public int st_nlocks;
  The number of current locks.
public int st_maxnlocks;
  The maximum number of locks at any one time.
public int st_nlockers;
  The number of current lockers.
public int st_maxnlockers;
  The maximum number of lockers at any one time.
public int st_nobjects;
  The number of current objects.
public int st_maxnobjects;
  The maximum number of objects at any one time.
public int st_nrequests;
  The total number of locks requested.
public int st_nreleases;
  The total number of locks released.
public int st_nnowaits;
  The total number of lock requests that failed because Db.DB_LOCK_NOWAIT was set.
public int st_nconflicts;
  The total number of locks not immediately available due to conflicts.
public int st_ndeadlocks;
  The number of deadlocks detected.
public int st_regsize;
  The size of the region.
public int st_region_wait;
  The number of times that a thread of control was forced to wait before obtaining the region lock.
public int st_region_nowait;
  The number of times that a thread of control was able to obtain the region lock without waiting.

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

# Errors

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

### Classes

DbEnv, DbLock

# See Also

DbEnv.set_lk_conflicts, DbEnv.set_lk_detect, DbEnv.set_lk_max_locks, DbEnv.set_lk_max_lockers, DbEnv.set_lk_max_objects, DbEnv.set_lk_max, DbEnv.lock_detect, DbEnv.lock_get, DbEnv.lock_id, DbLock.put and DbEnv.lock_stat.`

Copyright Sleepycat Software