This is an automated email from the ASF dual-hosted git repository.

zhaoqingran pushed a commit to branch script
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git

commit e8aeaf52e374a55643248901b59302770b3d9f13
Author: Logic <[email protected]>
AuthorDate: Mon Sep 2 16:34:21 2024 +0800

    docs: update Java version requirements in deployment documentation
    
     Specify the Java version in deployment instructions to clarify the 
prerequisites for installing Apache HertzBeat (incubating) version 1.6.0 and 
later. The update ensures users are aware of the need for Java 17 when 
deploying these versions.
---
 .../hertzbeat/collector/script/GraalJavaScriptExecutor.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/script/GraalJavaScriptExecutor.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/script/GraalJavaScriptExecutor.java
index 4a349c437..3150b58ea 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/script/GraalJavaScriptExecutor.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/script/GraalJavaScriptExecutor.java
@@ -19,6 +19,7 @@ package org.apache.hertzbeat.collector.script;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import org.apache.hertzbeat.common.cache.CacheFactory;
 import org.apache.hertzbeat.common.constants.ScriptTypeEnum;
 import org.apache.hertzbeat.common.script.ScriptExecutor;
 import org.graalvm.polyglot.Context;
@@ -35,7 +36,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class GraalJavaScriptExecutor extends ScriptExecutor {
 
-    private final Map<String, Source> scriptMap = new ConcurrentHashMap<>();
     private final Engine engine;
 
     public GraalJavaScriptExecutor() {
@@ -44,7 +44,7 @@ public class GraalJavaScriptExecutor extends ScriptExecutor {
 
     @Override
     public Object executeScript(String scriptKey) {
-        Source source = scriptMap.get(scriptKey);
+        Source source = (Source) CacheFactory.getScriptCache().get(scriptKey);
         if (source == null) {
             throw new RuntimeException("Script not found in cache");
         }
@@ -66,7 +66,7 @@ public class GraalJavaScriptExecutor extends ScriptExecutor {
 
     @Override
     public void cleanCache() {
-        scriptMap.clear();
+        CacheFactory.getScriptCache().clear();
     }
 
     @Override
@@ -81,7 +81,7 @@ public class GraalJavaScriptExecutor extends ScriptExecutor {
         Source source = Source.create("js", wrapScript);
         context.parse(source);
         // Cache the parsed script
-        scriptMap.put(script, source);
+        CacheFactory.getScriptCache().put(script, source);
         return wrapScript;
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to