From 796f9c0287bbbad795cd4b0b6896135cd9518749 Mon Sep 17 00:00:00 2001 From: zhangstar333 <2561612514@qq.com> Date: Tue, 21 May 2024 14:36:21 +0800 Subject: [PATCH] update --- be/src/util/jni-util.cpp | 10 +++++----- be/src/util/jni-util.h | 2 +- .../apache/doris/common/classloader/ScannerLoader.java | 4 ++-- .../main/java/org/apache/doris/udf/UdfExecutor.java | 10 +++++----- .../org/apache/doris/analysis/CreateFunctionStmt.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp index a708e68b9229855..02d20ed9a4fe809 100644 --- a/be/src/util/jni-util.cpp +++ b/be/src/util/jni-util.cpp @@ -177,7 +177,7 @@ jmethodID JniUtil::get_jmx_json_ = nullptr; jobject JniUtil::jni_scanner_loader_obj_ = nullptr; jmethodID JniUtil::jni_scanner_loader_method_ = nullptr; jlong JniUtil::max_jvm_heap_memory_size_ = 0; -jmethodID JniUtil::_drop_udf_cache_method_id = nullptr; +jmethodID JniUtil::_clean_udf_cache_method_id = nullptr; Status JniUtfCharGuard::create(JNIEnv* env, jstring jstr, JniUtfCharGuard* out) { DCHECK(jstr != nullptr); @@ -443,9 +443,9 @@ Status JniUtil::init_jni_scanner_loader(JNIEnv* env) { env->CallVoidMethod(jni_scanner_loader_obj_, load_jni_scanner); RETURN_ERROR_IF_EXC(env); - _drop_udf_cache_method_id = env->GetMethodID(jni_scanner_loader_cls, "removeUdfClassLoader", - "(Ljava/lang/String;)V"); - if (_drop_udf_cache_method_id == nullptr) { + _clean_udf_cache_method_id = env->GetMethodID(jni_scanner_loader_cls, "cleanUdfClassLoader", + "(Ljava/lang/String;)V"); + if (_clean_udf_cache_method_id == nullptr) { if (env->ExceptionOccurred()) { env->ExceptionDescribe(); } @@ -458,7 +458,7 @@ Status JniUtil::init_jni_scanner_loader(JNIEnv* env) { Status JniUtil::clean_udf_class_load_cache(const std::string& function_signature) { JNIEnv* env = nullptr; RETURN_IF_ERROR(JniUtil::GetJNIEnv(&env)); - env->CallVoidMethod(jni_scanner_loader_obj_, _drop_udf_cache_method_id, + env->CallVoidMethod(jni_scanner_loader_obj_, _clean_udf_cache_method_id, env->NewStringUTF(function_signature.c_str())); RETURN_ERROR_IF_EXC(env); return Status::OK(); diff --git a/be/src/util/jni-util.h b/be/src/util/jni-util.h index 1302c7aa9f8db6f..666a5e526dfbdaf 100644 --- a/be/src/util/jni-util.h +++ b/be/src/util/jni-util.h @@ -108,7 +108,7 @@ class JniUtil { // Thread-local cache of the JNIEnv for this thread. static __thread JNIEnv* tls_env_; static jlong max_jvm_heap_memory_size_; - static jmethodID _drop_udf_cache_method_id; + static jmethodID _clean_udf_cache_method_id; }; /// Helper class for lifetime management of chars from JNI, releasing JNI chars when diff --git a/fe/be-java-extensions/java-common/src/main/java/org/apache/doris/common/classloader/ScannerLoader.java b/fe/be-java-extensions/java-common/src/main/java/org/apache/doris/common/classloader/ScannerLoader.java index 1f36dd88b33cf94..2bbbd21838c9f2b 100644 --- a/fe/be-java-extensions/java-common/src/main/java/org/apache/doris/common/classloader/ScannerLoader.java +++ b/fe/be-java-extensions/java-common/src/main/java/org/apache/doris/common/classloader/ScannerLoader.java @@ -75,8 +75,8 @@ public static synchronized void cacheClassLoader(String functionSignature, Class udfLoadedClasses.put(functionSignature, classLoader, expirationTime * 60 * 1000L); } - public synchronized void removeUdfClassLoader(String functionSignature) { - LOG.info("removeUdfClassLoader for: " + functionSignature); + public synchronized void cleanUdfClassLoader(String functionSignature) { + LOG.info("cleanUdfClassLoader for: " + functionSignature); udfLoadedClasses.remove(functionSignature); } diff --git a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java index f649142f359fb13..ef120b2b9134428 100644 --- a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java +++ b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java @@ -140,7 +140,7 @@ private Method findPrepareMethod(Method[] methods) { return null; // Method not found } - public ClassLoader getClassLoader(String jarPath, String signature, long expirationTimeMs) + public ClassLoader getClassLoader(String jarPath, String signature, long expirationTime) throws MalformedURLException, FileNotFoundException { ClassLoader loader = null; if (jarPath == null) { @@ -155,7 +155,7 @@ public ClassLoader getClassLoader(String jarPath, String signature, long expirat classLoader = UdfUtils.getClassLoader(jarPath, parent); loader = classLoader; if (isStaticLoad) { - ScannerLoader.cacheClassLoader(signature, loader, expirationTimeMs); + ScannerLoader.cacheClassLoader(signature, loader, expirationTime); } } } @@ -174,11 +174,11 @@ protected void init(TJavaUdfExecutorCtorParams request, String jarPath, Type fun LOG.debug("Loading UDF '" + className + "' from " + jarPath); } isStaticLoad = request.getFn().isSetIsStaticLoad() && request.getFn().is_static_load; - long expirationTimeMs = 360L; // default is 6 hours + long expirationTime = 360L; // default is 6 hours if (request.getFn().isSetExpirationTime()) { - expirationTimeMs = request.getFn().getExpirationTime(); + expirationTime = request.getFn().getExpirationTime(); } - ClassLoader loader = getClassLoader(jarPath, request.getFn().getSignature(), expirationTimeMs); + ClassLoader loader = getClassLoader(jarPath, request.getFn().getSignature(), expirationTime); Class c = Class.forName(className, true, loader); methodAccess = MethodAccess.get(c); Constructor ctor = c.getConstructor(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java index 57df83b67ee26a6..abc2249a00be7bd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java @@ -302,7 +302,7 @@ private void analyzeCommon(Analyzer analyzer) throws AnalysisException { throw new AnalysisException("expirationTime should greater than zero: "); } this.expirationTime = timeMinutes; - } + } } }