5454 */
5555public final class Dbi <T > {
5656
57+ private boolean cleaned ;
5758 private final Comparator <T > compFunc ;
5859 private final T compKeyA ;
5960 private final T compKeyB ;
@@ -62,8 +63,6 @@ public final class Dbi<T> {
6263 private final BufferProxy <T > proxy ;
6364 private final Pointer ptr ;
6465
65- private boolean isClean ;
66-
6766 Dbi (final Env <T > env , final Txn <T > txn , final byte [] name ,
6867 final Comparator <T > comparator , final DbiFlags ... flags ) {
6968 this .env = env ;
@@ -107,17 +106,6 @@ public void close() {
107106 LIB .mdb_dbi_close (env .pointer (), ptr );
108107 }
109108
110- private void clean () {
111- if (isClean ) {
112- return ;
113- }
114- isClean = true ;
115- if (compKeyA != null ) {
116- proxy .deallocate (compKeyA );
117- proxy .deallocate (compKeyB );
118- }
119- }
120-
121109 /**
122110 * Starts a new read-write transaction and deletes the key.
123111 *
@@ -201,10 +189,10 @@ public void drop(final Txn<T> txn) {
201189
202190 /**
203191 * Drops the database. If delete is set to true, the database will be deleted
204- * and handle will be closed. See {@link #close()} for implication of handle close.
205- * Otherwise, only the data in this database will be dropped.
192+ * and handle will be closed. See {@link #close()} for implication of handle
193+ * close. Otherwise, only the data in this database will be dropped.
206194 *
207- * @param txn transaction handle (not null; not committed; must be R-W)
195+ * @param txn transaction handle (not null; not committed; must be R-W)
208196 * @param delete whether database should be deleted.
209197 */
210198 public void drop (final Txn <T > txn , final boolean delete ) {
@@ -500,6 +488,17 @@ public Stat stat(final Txn<T> txn) {
500488 stat .f5_ms_entries .longValue ());
501489 }
502490
491+ private void clean () {
492+ if (cleaned ) {
493+ return ;
494+ }
495+ cleaned = true ;
496+ if (compKeyA != null ) {
497+ proxy .deallocate (compKeyA );
498+ proxy .deallocate (compKeyB );
499+ }
500+ }
501+
503502 /**
504503 * The specified DBI was changed unexpectedly.
505504 */
0 commit comments