1<!--$Id: lockng.so,v 1.6 2004/09/28 14:13:09 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Release 4.2: DB_LOCK_NOTGRANTED</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></b></td> 13<td align=right><a href="/upgrade.4.2/verify.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.4.2/repinit.html"><img src="/images/next.gif" alt="Next"></a> 14</td></tr></table> 15<p align=center><b>Release 4.2: DB_LOCK_NOTGRANTED</b></p> 16<p>In previous releases, configuring lock or transaction timeout values or 17calling the <a href="/api_c/txn_begin.html">DB_ENV->txn_begin</a> method with the <a href="/api_c/txn_begin.html#DB_TXN_NOWAIT">DB_TXN_NOWAIT</a> flag 18caused database operation methods to return <a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a>, 19or throw a <a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception. This 20required applications to unnecessarily handle multiple errors or 21exception types.</p> 22<p>In the Berkeley DB 4.2 release, with one exception, database operations will 23no longer return <a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a> or throw a 24<a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception. Instead, database 25operations will return <a href="/ref/program/errorret.html#DB_LOCK_DEADLOCK">DB_LOCK_DEADLOCK</a> or throw a 26<a href="/api_cxx/deadlock_class.html">DbDeadlockException</a> exception. This change should require 27no application changes, as applications must already be dealing with the 28possible <a href="/ref/program/errorret.html#DB_LOCK_DEADLOCK">DB_LOCK_DEADLOCK</a> error return or 29<a href="/api_cxx/deadlock_class.html">DbDeadlockException</a> exception from database operations.</p> 30<p>The one exception to this rule is the <a href="/api_c/db_get.html">DB->get</a> method using the 31<a href="/api_c/db_get.html#DB_CONSUME_WAIT">DB_CONSUME_WAIT</a> flag to consume records from a Queue. If lock 32or transaction timeouts are set, this method and flag combination may 33return <a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a> or throw a 34<a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception.</p> 35<p>Applications wanting to distinguish between true deadlocks and timeouts 36can configure database operation methods to return 37<a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a> or throw a 38<a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception using the 39<a href="/api_c/env_set_flags.html#DB_TIME_NOTGRANTED">DB_TIME_NOTGRANTED</a> flag.</p> 40<p>The <a href="/api_c/lock_get.html">DB_ENV->lock_get</a> and <a href="/api_c/lock_vec.html">DB_ENV->lock_vec</a> methods will continue to return 41<a href="/ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a>, or throw a 42<a href="/api_cxx/lockng_class.html">DbLockNotGrantedException</a> exception as they have previously 43done.</p> 44<table width="100%"><tr><td><br></td><td align=right><a href="/upgrade.4.2/verify.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.4.2/repinit.html"><img src="/images/next.gif" alt="Next"></a> 45</td></tr></table> 46<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 47</body> 48</html> 49