db_release_unused_handles

one of the documented procedures in this installation of the ACS
Usage:
db_release_unused_handles
What it does:
Releases any database handles that are presently unused.
Defined in: /web/philip/packages/acs-core/10-database-procs.tcl

Source code:


    global ad_conn

    if { [info exists ad_conn(db,n_handles_used)] } {
	# Examine the elements at the end of ad_conn(db,handles), killing off
	# handles that are unused and not engaged in a transaction.

	set index_to_examine [expr { [llength $ad_conn(db,handles)] - 1 }]
	while { $index_to_examine >= $ad_conn(db,n_handles_used) } {
	    set db [lindex $ad_conn(db,handles) $index_to_examine]

	    # Stop now if the handle is part of a transaction.
	    if { [info exists ad_conn(db,transaction_level,$db)] &&  $ad_conn(db,transaction_level,$db) > 0 } {
		break
	    }

	    ns_db releasehandle $db
	    incr index_to_examine -1
	}
	set ad_conn(db,handles) [lrange $ad_conn(db,handles) 0 $index_to_examine]
    }


philg@mit.edu