X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fyaz4j%2FScanSet.java;h=3eaea9495c1e43035032fa7860a81843fda3fffa;hb=392b45440ddab42427a0a6e5f24d1a5e8eb28375;hp=2140cc54f2a9c2304c40b4d68fff95327be9066c;hpb=2def7bc64faa1dfb9f3393f2c2ef0bca0c6265e1;p=yaz4j-moved-to-github.git diff --git a/src/main/java/org/yaz4j/ScanSet.java b/src/main/java/org/yaz4j/ScanSet.java index 2140cc5..3eaea94 100644 --- a/src/main/java/org/yaz4j/ScanSet.java +++ b/src/main/java/org/yaz4j/ScanSet.java @@ -1,23 +1,22 @@ package org.yaz4j; import org.yaz4j.jni.SWIGTYPE_p_ZOOM_scanset_p; -import org.yaz4j.jni.SWIGTYPE_p_int; import org.yaz4j.jni.SWIGTYPE_p_size_t; import org.yaz4j.jni.yaz4jlib; public class ScanSet { - - private SWIGTYPE_p_ZOOM_scanset_p scanSet = null; - private Connection connection; + //for GC ref-count + private Connection conn; + private SWIGTYPE_p_ZOOM_scanset_p scanSet; private boolean disposed = false; - ScanSet(SWIGTYPE_p_ZOOM_scanset_p scanSet, Connection connection) { - this.connection = connection; + ScanSet(SWIGTYPE_p_ZOOM_scanset_p scanSet, Connection conn) { this.scanSet = scanSet; + this.conn = conn; } public void finalize() { - dispose(); + _dispose(); } public ScanTerm get(long index) { @@ -34,11 +33,11 @@ public class ScanSet { return yaz4jlib.ZOOM_scanset_size(scanSet); } - public void dispose() { + void _dispose() { if (!disposed) { yaz4jlib.ZOOM_scanset_destroy(scanSet); - connection = null; scanSet = null; + conn = null; disposed = true; } }