"Fossies" - the Fresh Open Source Software Archive

Member "jacl1.4.1/docs/TclJava/JavaLockCmd.html" (25 Jan 2000, 1209 Bytes) of package /linux/misc/old/jacl1.4.1.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. Alternatively you can here view or download the uninterpreted raw source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

The java::lock Command


java::lock javaObj

The java::lock command prevents the Java object, javaObj, from getting garbage collected. A Tcl variable that stores a Java object handle has an internal rep that holds a reference to the Java object. If the Tcl variable's internal rep is changed (e.g. to a Tcl List), the reference to the Java object is removed, and the Java object could be garbage collected. The java::lock command maintains a copy of javaObj's internal rep, so the Java object will be not be garbage collected. Multiple locks can be placed on the same Java object. If javaObject is not a valid reference to a Java object, a Tcl error is generated. It is important to note that use of the java::lock command is optional, it is not required. A Java object handle that is stored in a Tcl variable will not be garbage collected unless the Tcl variable is unset, or the internal representation is changed.

Copyright © 1997-1998 Sun Microsystems, Inc.