summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2016-12-06 10:03:13 +1100
committerGitHub <noreply@github.com>2016-12-06 10:03:13 +1100
commit1435e0c1144a058b3cb2b5883bda09052f79cc19 (patch)
tree60b562016008db77e3f610ad0067e3c40883fdd5 /lang
parentf514d647cec430a3611d569ad8e4553bd6361a4f (diff)
downloadmongo-1435e0c1144a058b3cb2b5883bda09052f79cc19.tar.gz
WT-3053 Revert: Python and Java support use internal WiredTiger functions (#3178)
Diffstat (limited to 'lang')
-rw-r--r--lang/java/wiredtiger.i20
-rw-r--r--lang/python/wiredtiger.i15
2 files changed, 9 insertions, 26 deletions
diff --git a/lang/java/wiredtiger.i b/lang/java/wiredtiger.i
index e5611ac192f..b7515440040 100644
--- a/lang/java/wiredtiger.i
+++ b/lang/java/wiredtiger.i
@@ -362,7 +362,7 @@ javaClose(JNIEnv *env, WT_SESSION *session, JAVA_CALLBACK *jcb, jfieldID *pfid)
(*env)->SetLongField(env, jcb->jobj, fid, 0L);
(*env)->DeleteGlobalRef(env, jcb->jobj);
- free(jcb);
+ __wt_free(jcb->session, jcb);
return (0);
}
@@ -427,8 +427,6 @@ javaAsyncHandler(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
jobject jcallback;
JNIEnv *jenv;
WT_ASYNC_OP_IMPL *op;
- WT_EXTENSION_API *wt_api;
- WT_SESSION *wt_session;
WT_SESSION_IMPL *session;
WT_UNUSED(cb);
@@ -513,12 +511,7 @@ javaAsyncHandler(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
(*jenv)->ExceptionClear(jenv);
}
if (0) {
-err: wt_session = (WT_SESSION *)session;
- wt_api = wt_session->
- connection->get_extension_api(wt_session->connection);
- (void)wt_api->err_printf(wt_api, wt_session,
- "Java async callback error: %s",
- wt_api->strerror(wt_api, wt_session, ret));
+err: __wt_err(session, ret, "Java async callback error");
}
/* Invalidate the AsyncOp, further use throws NullPointerException. */
@@ -1952,7 +1945,7 @@ WT_CONNECTION *wiredtiger_open_wrap(JNIEnv *jenv, const char *home, const char *
goto err;
connimpl = (WT_CONNECTION_IMPL *)conn;
- if ((jcb = calloc(1, sizeof(JAVA_CALLBACK))) == NULL)
+ if ((ret = __wt_calloc_def(connimpl->default_session, 1, &jcb)) != 0)
goto err;
jcb->jnienv = jenv;
@@ -1977,7 +1970,7 @@ err: if (ret != 0)
goto err;
connimpl = (WT_CONNECTION_IMPL *)$self;
- if ((jcb = calloc(1, sizeof(JAVA_CALLBACK))) == NULL)
+ if ((ret = __wt_calloc_def(connimpl->default_session, 1, &jcb)) != 0)
goto err;
jcb->jnienv = jenv;
@@ -2006,7 +1999,7 @@ err: if (ret != 0)
goto err;
sessionimpl = (WT_SESSION_IMPL *)session;
- if ((jcb = calloc(1, sizeof(JAVA_CALLBACK))) == NULL)
+ if ((ret = __wt_calloc_def(sessionimpl, 1, &jcb)) != 0)
goto err;
jcb->jnienv = jenv;
@@ -2027,7 +2020,8 @@ err: if (ret != 0)
if ((ret = $self->open_cursor($self, uri, to_dup, config, &cursor)) != 0)
goto err;
- if ((jcb = calloc(1, sizeof(JAVA_CALLBACK))) == NULL)
+ if ((ret = __wt_calloc_def((WT_SESSION_IMPL *)cursor->session,
+ 1, &jcb)) != 0)
goto err;
if ((cursor->flags & WT_CURSTD_RAW) != 0)
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i
index 66627e5aa95..a28d3ac4c19 100644
--- a/lang/python/wiredtiger.i
+++ b/lang/python/wiredtiger.i
@@ -366,11 +366,7 @@ retry:
SWIG_ERROR_IF_NOT_SET(result);
else if (result == EBUSY) {
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
-%#if defined(_MSC_VER)
- (void)Sleep(10); /* ms */
-%#else
- (void)usleep(10000); /* us */
-%#endif
+ __wt_sleep(0, 10000);
SWIG_PYTHON_THREAD_END_ALLOW;
goto retry;
}
@@ -1153,8 +1149,6 @@ pythonAsyncCallback(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
PY_CALLBACK *pcb;
PyObject *arglist, *notify_method, *pyresult;
WT_ASYNC_OP_IMPL *op;
- WT_EXTENSION_API *wt_api;
- WT_SESSION *wt_session;
WT_SESSION_IMPL *session;
/*
@@ -1185,12 +1179,7 @@ pythonAsyncCallback(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
if (0) {
if (ret == 0)
ret = EINVAL;
-err: wt_session = (WT_SESSION *)session;
- wt_api = wt_session->
- connection->get_extension_api(wt_session->connection);
- (void)wt_api->err_printf(wt_api, wt_session,
- "python async callback error: %s",
- wt_api->strerror(wt_api, wt_session, ret));
+err: __wt_err(session, ret, "python async callback error");
}
Py_XDECREF(pyresult);
Py_XDECREF(notify_method);