2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1997-2002
5
* Sleepycat Software. All rights reserved.
10
static const char revid[] = "$Id$";
22
#include "java_util.h"
23
#include "com_sleepycat_db_DbLogc.h"
25
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_close
26
(JNIEnv *jnienv, jobject jthis, jint flags)
29
DB_LOGC *dblogc = get_DB_LOGC(jnienv, jthis);
31
if (!verify_non_null(jnienv, dblogc))
33
err = dblogc->close(dblogc, flags);
34
if (verify_return(jnienv, err, 0)) {
35
set_private_dbobj(jnienv, name_DB_LOGC, jthis, 0);
39
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogc_get
40
(JNIEnv *jnienv, jobject jthis,
41
/*DbLsn*/ jobject lsn, /*Dbt*/ jobject data, jint flags)
50
* Depending on flags, the user may be supplying the key,
51
* or else we may have to retrieve it.
56
dblogc = get_DB_LOGC(jnienv, jthis);
57
dblsn = get_DB_LSN(jnienv, lsn);
58
if (locked_dbt_get(&ldata, jnienv, dblogc->dbenv, data, dataop) != 0)
61
if (!verify_non_null(jnienv, dblogc))
64
for (retry = 0; retry < 3; retry++) {
65
err = dblogc->get(dblogc, dblsn, &ldata.javainfo->dbt, flags);
68
* If we failed due to lack of memory in our DBT arrays,
73
if (!locked_dbt_realloc(&ldata, jnienv, dblogc->dbenv))
77
locked_dbt_put(&ldata, jnienv, dblogc->dbenv);
78
if (!DB_RETOK_LGGET(err)) {
79
if (verify_dbt(jnienv, err, &ldata))
80
verify_return(jnienv, err, 0);
85
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_finalize
86
(JNIEnv *jnienv, jobject jthis)
89
* Free any data related to DB_LOGC here.
90
* If we ever have java-only data embedded in the DB_LOGC
91
* and need to do this, we'll have to track DbLogc's
92
* according to which DbEnv owns them, just as
93
* we track Db's according to which DbEnv owns them.
94
* That's necessary to avoid double freeing that
95
* comes about when closes interact with GC.
101
dblogc = get_DB_LOGC(jnienv, jthis);
103
fprintf(stderr, "Java API: DbLogc has not been closed\n");
106
COMPQUIET(jnienv, NULL);
107
COMPQUIET(jthis, NULL);