ShadowySpirits commented on code in PR #2276:
URL: 
https://github.com/apache/incubator-opendal/pull/2276#discussion_r1199703128


##########
bindings/java/src/lib.rs:
##########
@@ -15,71 +15,49 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::cell::RefCell;
 use std::collections::HashMap;
 use std::ffi::c_void;
 use std::str::FromStr;
-use std::sync::Arc;
 
 use jni::objects::JClass;
 use jni::objects::JMap;
 use jni::objects::JObject;
 use jni::objects::JString;
 use jni::objects::JThrowable;
 use jni::objects::JValue;
-use jni::sys::jboolean;
-use jni::sys::jint;
-use jni::sys::jlong;
-use jni::sys::JNI_VERSION_1_8;
-use jni::JNIEnv;
-use jni::JavaVM;
+use jni::sys::{jboolean, jobject, JNI_VERSION_1_8};
+use jni::sys::{jint, jlong};
+use jni::{JNIEnv, JavaVM};
 use once_cell::sync::OnceCell;
+use tokio::runtime::Builder;
+use tokio::runtime::Runtime;
+
 use opendal::BlockingOperator;
 use opendal::Operator;
 use opendal::Scheme;
-use tokio::runtime::Builder;
-use tokio::runtime::Runtime;
 
 static mut RUNTIME: OnceCell<Runtime> = OnceCell::new();
-
-thread_local! {

Review Comment:
   The function "attach_current_thread_as_daemon" incurs overhead because it 
calls GetEnv via JNI. Additionally, calling this function in every asynchronous 
function seems strange. To improve clarity, why not cache the ENV in 
thread-local?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to