Skip to content

Commit

Permalink
feat(jans-core): wip for compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriyz committed May 18, 2022
1 parent 97a6403 commit 7eef650
Showing 1 changed file with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
* @author Yuriy Zabrovarnyy
Expand Down Expand Up @@ -107,6 +104,7 @@ private void outputUrls(ClassLoader classLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
for (URL url : urls) {
log.info("system url: {}", url.getFile());
CompilerUtils.addClassPath(url.getFile());
}
} catch (Throwable e) {
log.error("FAILED to output class loader urls", e);
Expand All @@ -126,32 +124,25 @@ private void outputTmpDir() {

private BaseExternalType createExternalTypeWithJava(CustomScript customScript) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
log.info(" STARTING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

// outputUrls(ClassLoader.getSystemClassLoader());
outputUrls(this.getClass().getClassLoader());
// outputUrls(Thread.currentThread().getContextClassLoader());

try {
CompilerUtils.addClassPath("WEB-INF/lib");
CompilerUtils.addClassPath("WEB-INF/classes");
CachedCompilerA.reset();
} catch (Throwable e) {
log.error("FAILED to modify class path");
}

outputUrls(ClassLoader.getSystemClassLoader());
outputUrls(this.getClass().getClassLoader());
outputUrls(Thread.currentThread().getContextClassLoader());

outputTmpDir();
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {
@Override
public void run() {
outputTmpDir();
}
}, 10, TimeUnit.SECONDS);

// outputTmpDir();

log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
log.info("SYSTEM properties > java.io.tmpdir: {}", System.getProperties());
log.info("TMP > java.io.tmpdir: {}", System.getProperty("java.io.tmpdir"));
// log.info("SYSTEM properties > java.io.tmpdir: {}", System.getProperties());
// log.info("TMP > java.io.tmpdir: {}", System.getProperty("java.io.tmpdir"));
log.info("CLASSPATH > java.class.path: {}", System.getProperty("java.class.path"));


log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
CustomScriptType customScriptType = customScript.getScriptType();
Class<?> aClass = CachedCompilerA.CACHED_COMPILER.loadFromJava(customScriptType.getClassName(), customScript.getScript());
Expand Down

0 comments on commit 7eef650

Please sign in to comment.