Skip to content

Commit

Permalink
remove static init call for caches (no longer needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 15, 2023
1 parent e50d359 commit e141189
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 38 deletions.
3 changes: 0 additions & 3 deletions core/src/main/java/lucee/runtime/cache/ram/RamCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ public RamCache() {
}
}

public static void init(Config config, String[] cacheNames, Struct[] arguments) {// print.ds();
}

@Override
public void init(Config config, String cacheName, Struct arguments) throws IOException {
// RamCache is also used without calling init, because of that we have this test in constructor and
Expand Down
55 changes: 22 additions & 33 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -2652,36 +2650,28 @@ else if (cd.getClassName() != null
}
}
}
// call
Iterator<Entry<ClassDefinition, List<CacheConnection>>> it = _caches.entrySet().iterator();
Entry<ClassDefinition, List<CacheConnection>> entry;
List<CacheConnection> list;
ClassDefinition _cd;
while (it.hasNext()) {
entry = it.next();
list = entry.getValue();
_cd = entry.getKey();
try {
Method m = _cd.getClazz().getMethod("init", new Class[] { Config.class, String[].class, Struct[].class });
if (Modifier.isStatic(m.getModifiers())) m.invoke(null, new Object[] { config, _toCacheNames(list), _toArguments(list) });
else LogUtil.logGlobal(ThreadLocalPageContext.getConfig(configServer == null ? config : configServer), Log.LEVEL_ERROR, ConfigWebFactory.class.getName(),
"method [init(Config,String[],Struct[]):void] for class [" + _cd.toString() + "] is not static");

}
catch (InvocationTargetException e) {
log.error("Cache", e.getTargetException());
}
catch (RuntimeException e) {
log.error("Cache", e);
}
catch (NoSuchMethodException e) {
log.error("Cache", "missing method [public static init(Config,String[],Struct[]):void] for class [" + _cd.toString() + "] ");
}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
log.error("Cache", e);
}
}
// call static init
// Iterator<Entry<ClassDefinition, List<CacheConnection>>> it = _caches.entrySet().iterator();
// Entry<ClassDefinition, List<CacheConnection>> entry;
// List<CacheConnection> list;
// ClassDefinition _cd;
/*
* while (it.hasNext()) { entry = it.next(); list = entry.getValue(); _cd = entry.getKey();
*
* try { Method m = _cd.getClazz().getMethod("init", new Class[] { Config.class, String[].class,
* Struct[].class }); if (Modifier.isStatic(m.getModifiers())) m.invoke(null, new Object[] { config,
* _toCacheNames(list), _toArguments(list) }); else
* LogUtil.logGlobal(ThreadLocalPageContext.getConfig(configServer == null ? config : configServer),
* Log.LEVEL_ERROR, ConfigWebFactory.class.getName(),
* "method [init(Config,String[],Struct[]):void] for class [" + _cd.toString() + "] is not static");
* } catch (InvocationTargetException e) { log.error("Cache", e.getTargetException()); } catch
* (RuntimeException e) { log.error("Cache", e); } catch (NoSuchMethodException e) {
* log.error("Cache",
* "missing method [public static init(Config,String[],Struct[]):void] for class [" + _cd.toString()
* + "] "); } catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); log.error("Cache", e); }
*
* }
*/
}

// Copy Parent caches as readOnly
Expand Down Expand Up @@ -4866,7 +4856,6 @@ private static void _loadCFX(ConfigServerImpl configServer, ConfigImpl config, S
private static void _loadExtensionBundles(ConfigServerImpl cs, ConfigImpl config, Struct root, Log log) {
Log deployLog = config.getLog("deploy");
if (deployLog != null) log = deployLog;

try {
boolean changed = false;
if (config instanceof ConfigServer) {
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.1.0.13-ALPHA"/>
<property name="version" value="6.1.0.14-ALPHA"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.1.0.13-ALPHA</version>
<version>6.1.0.14-ALPHA</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit e141189

Please sign in to comment.