From 1a0dccea7cde8f0206a60e39b0b8da16cc56f10a Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Mon, 18 Nov 2024 20:53:34 +0100 Subject: [PATCH] load spooler and resources settings on demand --- .../java/lucee/runtime/config/ConfigImpl.java | 185 ++++++++++++------ .../runtime/config/ConfigWebFactory.java | 70 +++---- .../runtime/spooler/SpoolerEngineImpl.java | 90 ++++----- .../main/java/lucee/runtime/tag/Admin.java | 7 +- loader/build.xml | 2 +- loader/pom.xml | 2 +- 6 files changed, 200 insertions(+), 156 deletions(-) diff --git a/core/src/main/java/lucee/runtime/config/ConfigImpl.java b/core/src/main/java/lucee/runtime/config/ConfigImpl.java index 42f6a19433..e6d8afa4b4 100755 --- a/core/src/main/java/lucee/runtime/config/ConfigImpl.java +++ b/core/src/main/java/lucee/runtime/config/ConfigImpl.java @@ -145,6 +145,7 @@ import lucee.runtime.search.SearchEngine; import lucee.runtime.security.SecurityManager; import lucee.runtime.spooler.SpoolerEngine; +import lucee.runtime.spooler.SpoolerEngineImpl; import lucee.runtime.type.Array; import lucee.runtime.type.ArrayImpl; import lucee.runtime.type.Collection.Key; @@ -312,12 +313,15 @@ public abstract class ConfigImpl extends ConfigBase implements ConfigPro { private CharSet mailDefaultCharset; private Resources resources = new ResourcesImpl(); + private boolean initResource = true; private Map> cacheHandlerClasses; private ApplicationListener applicationListener; private Integer scriptProtect; + private ResourceProvider defaultResourceProvider; + private ProxyData proxy = null; private Resource clientScopeDir; @@ -353,6 +357,7 @@ public abstract class ConfigImpl extends ConfigBase implements ConfigPro { private SpoolerEngine remoteClientSpoolerEngine; private Resource remoteClientDirectory; + private Integer remoteClientMaxThreads; private Boolean allowURLRequestTimeout; private Boolean errorStatusCode; @@ -529,7 +534,6 @@ public void reset() { clearApplicationCache(); clearLoggers(null); clearComponentMetadata(); - clearResourceProviders(); baseComponentPageSource = null; } @@ -2856,21 +2860,18 @@ protected void setMailDefaultEncoding(Charset mailDefaultCharset) { this.mailDefaultCharset = CharsetUtil.toCharSet(mailDefaultCharset); } - protected void setDefaultResourceProvider(Class defaultProviderClass, Map arguments) throws ClassException { - Object o = ClassUtil.loadInstance(defaultProviderClass); - if (o instanceof ResourceProvider) { - ResourceProvider rp = (ResourceProvider) o; - rp.init(null, arguments); - setDefaultResourceProvider(rp); - } - else throw new ClassException("object [" + Caster.toClassName(o) + "] must implement the interface " + ResourceProvider.class.getName()); - } - /** * @param defaultResourceProvider the defaultResourceProvider to set */ protected void setDefaultResourceProvider(ResourceProvider defaultResourceProvider) { - resources.registerDefaultResourceProvider(defaultResourceProvider); + if (defaultResourceProvider == null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getCacheHandlers")) { + if (cacheHandlerClasses == null) { + cacheHandlerClasses = ConfigWebFactory.loadCacheHandler(this, root, getLog()); + } + } + } + getResources().registerDefaultResourceProvider(defaultResourceProvider); } /** @@ -2878,9 +2879,31 @@ protected void setDefaultResourceProvider(ResourceProvider defaultResourceProvid */ @Override public ResourceProvider getDefaultResourceProvider() { + Resources resources = getResources(); + if (defaultResourceProvider == null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getDefaultResourceProvider")) { + if (defaultResourceProvider == null) { + defaultResourceProvider = ConfigWebFactory.loadDefaultResourceProvider(this, root, getLog()); + if (defaultResourceProvider == null) defaultResourceProvider = ResourcesImpl.getFileResourceProvider(); + if (defaultResourceProvider != resources.getDefaultResourceProvider()) resources.registerDefaultResourceProvider(defaultResourceProvider); + } + } + } return resources.getDefaultResourceProvider(); } + public ConfigImpl resetDefaultResourceProvider() { + if (defaultResourceProvider != null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getDefaultResourceProvider")) { + if (defaultResourceProvider != null) { + defaultResourceProvider = null; + getResources().registerDefaultResourceProvider(ResourcesImpl.getFileResourceProvider()); + } + } + } + return this; + } + @Override public Iterator>> getCacheHandlers() { if (cacheHandlerClasses == null) { @@ -2904,12 +2927,33 @@ public ConfigImpl resetCacheHandlers() { return this; } - protected void addResourceProvider(String strProviderScheme, ClassDefinition cd, Map arguments) { - ((ResourcesImpl) resources).registerResourceProvider(strProviderScheme, cd, arguments); + private Resources getResources() { + if (initResource) { + synchronized (SystemUtil.createToken("ConfigImpl", "getResources")) { + if (initResource) { + ConfigWebFactory.loadResourceProvider(this, root, getLog()); + initResource = false; + cacheHandlerClasses = null; + } + } + } + return resources; + } + + public ConfigImpl resetResources() { + if (!initResource) { + synchronized (SystemUtil.createToken("ConfigImpl", "getResources")) { + if (!initResource) { + initResource = true; + resources.reset(); + } + } + } + return this; } - public void clearResourceProviders() { - resources.reset(); + protected void addResourceProvider(String strProviderScheme, ClassDefinition cd, Map arguments) { + ((ResourcesImpl) resources).registerResourceProvider(strProviderScheme, cd, arguments); } /** @@ -2917,7 +2961,7 @@ public void clearResourceProviders() { */ @Override public ResourceProvider[] getResourceProviders() { - return resources.getResourceProviders(); + return getResources().getResourceProviders(); } /** @@ -2925,27 +2969,21 @@ public ResourceProvider[] getResourceProviders() { */ @Override public ResourceProviderFactory[] getResourceProviderFactories() { - return ((ResourcesImpl) resources).getResourceProviderFactories(); + return ((ResourcesImpl) getResources()).getResourceProviderFactories(); } @Override public boolean hasResourceProvider(String scheme) { - ResourceProviderFactory[] factories = ((ResourcesImpl) resources).getResourceProviderFactories(); + ResourceProviderFactory[] factories = ((ResourcesImpl) getResources()).getResourceProviderFactories(); for (int i = 0; i < factories.length; i++) { if (factories[i].getScheme().equalsIgnoreCase(scheme)) return true; } return false; } - protected void setResourceProviderFactories(ResourceProviderFactory[] resourceProviderFactories) { - for (int i = 0; i < resourceProviderFactories.length; i++) { - ((ResourcesImpl) resources).registerResourceProvider(resourceProviderFactories[i]); - } - } - @Override public Resource getResource(String path) { - return resources.getResource(path); + return getResources().getResource(path); } @Override @@ -3728,26 +3766,69 @@ protected void setShowVersion(boolean showVersion) { this.showVersion = showVersion; } - protected void setRemoteClients(RemoteClient[] remoteClients) { - this.remoteClients = remoteClients; - } - @Override public RemoteClient[] getRemoteClients() { - if (remoteClients == null) return new RemoteClient[0]; + print.ds(); + if (remoteClients == null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getRemoteClients")) { + if (remoteClients == null) { + remoteClients = ConfigWebFactory.loadRemoteClients(this, root, getLog()); + } + } + } return remoteClients; } + public ConfigImpl resetRemoteClients() { + if (remoteClients != null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getRemoteClients")) { + if (remoteClients != null) { + remoteClients = null; + } + } + } + return this; + } + @Override public SpoolerEngine getSpoolerEngine() { + if (remoteClientSpoolerEngine == null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getSpoolerEngine")) { + if (remoteClientSpoolerEngine == null) { + remoteClientSpoolerEngine = new SpoolerEngineImpl(this, "Remote Client Spooler"); + } + } + } return remoteClientSpoolerEngine; } - /** - * @return the remoteClientDirectory - */ + public int getRemoteClientMaxThreads() { + if (remoteClientMaxThreads == null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getRemoteClientMaxThreads")) { + if (remoteClientMaxThreads == null) { + Struct _clients = ConfigWebUtil.getAsStruct("remoteClients", root); + remoteClientMaxThreads = Caster.toInteger(ConfigWebFactory.getAttr(_clients, "maxThreads"), 20); + } + } + } + return remoteClientMaxThreads; + } + + public ConfigImpl resetRemoteClientMaxThreads() { + if (remoteClientMaxThreads != null) { + synchronized (SystemUtil.createToken("ConfigImpl", "getRemoteClientMaxThreads")) { + if (remoteClientMaxThreads != null) { + remoteClientMaxThreads = null; + } + } + } + return this; + } + + // @Override public Resource getRemoteClientDirectory() { + print.ds(); if (remoteClientDirectory == null) { synchronized (SystemUtil.createToken("ConfigImpl", "getRemoteClientDirectory")) { if (remoteClientDirectory == null) { @@ -3758,6 +3839,8 @@ public Resource getRemoteClientDirectory() { } remoteClientDirectory = ConfigWebUtil.getFile(getRootDirectory(), strDir, "client-task", getConfigDir(), FileUtil.TYPE_DIR, ResourceUtil.LEVEL_GRAND_PARENT_FILE, this); + + if (!remoteClientDirectory.exists()) remoteClientDirectory.mkdirs(); } } } @@ -3775,26 +3858,6 @@ public ConfigImpl resetRemoteClientDirectory() { return this; } - protected void setSpoolerEngine(SpoolerEngine spoolerEngine) { - this.remoteClientSpoolerEngine = spoolerEngine; - } - - /* - * * - * - * @return the structCase / public int getStructCase() { return structCase; } - */ - - /* - * * - * - * @param structCase the structCase to set / protected void setStructCase(int structCase) { - * this.structCase = structCase; } - */ - - /** - * @return if error status code will be returned or not - */ @Override public boolean getErrorStatusCode() { if (errorStatusCode == null) { @@ -4161,11 +4224,13 @@ public ConfigImpl resetTypeChecking() { @Override public int getInspectTemplateAutoInterval(boolean slow) { - if (inspectTemplateAutoIntervalSlow == -1) { + if (inspectTemplateAutoIntervalSlow == ConfigPro.INSPECT_INTERVAL_UNDEFINED) { synchronized (SystemUtil.createToken("ConfigImpl", "getInspectTemplateAutoInterval")) { - if (inspectTemplateAutoIntervalSlow == -1) { + if (inspectTemplateAutoIntervalSlow == ConfigPro.INSPECT_INTERVAL_UNDEFINED) { inspectTemplateAutoIntervalFast = Caster.toIntValue(ConfigWebFactory.getAttr(root, "inspectTemplateIntervalFast"), ConfigPro.INSPECT_INTERVAL_FAST); + if (inspectTemplateAutoIntervalFast <= 0) inspectTemplateAutoIntervalFast = ConfigPro.INSPECT_INTERVAL_FAST; inspectTemplateAutoIntervalSlow = Caster.toIntValue(ConfigWebFactory.getAttr(root, "inspectTemplateIntervalSlow"), ConfigPro.INSPECT_INTERVAL_SLOW); + if (inspectTemplateAutoIntervalSlow <= 0) inspectTemplateAutoIntervalSlow = ConfigPro.INSPECT_INTERVAL_SLOW; } } } @@ -4173,11 +4238,11 @@ public int getInspectTemplateAutoInterval(boolean slow) { } public ConfigImpl resetInspectTemplateAutoInterval() { - if (inspectTemplateAutoIntervalSlow != -1) { + if (inspectTemplateAutoIntervalSlow != ConfigPro.INSPECT_INTERVAL_UNDEFINED) { synchronized (SystemUtil.createToken("ConfigImpl", "getInspectTemplateAutoInterval")) { - if (inspectTemplateAutoIntervalSlow != -1) { - inspectTemplateAutoIntervalSlow = -1; - inspectTemplateAutoIntervalFast = -1; + if (inspectTemplateAutoIntervalSlow != ConfigPro.INSPECT_INTERVAL_UNDEFINED) { + inspectTemplateAutoIntervalSlow = ConfigPro.INSPECT_INTERVAL_UNDEFINED; + inspectTemplateAutoIntervalFast = ConfigPro.INSPECT_INTERVAL_UNDEFINED; } } } diff --git a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java index 81644beddf..f6c741170d 100644 --- a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java +++ b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java @@ -65,6 +65,7 @@ import lucee.commons.io.log.LogUtil; import lucee.commons.io.log.LoggerAndSourceData; import lucee.commons.io.res.Resource; +import lucee.commons.io.res.ResourceProvider; import lucee.commons.io.res.filter.ExtensionResourceFilter; import lucee.commons.io.res.type.cfml.CFMLResourceProvider; import lucee.commons.io.res.type.s3.DummyS3ResourceProvider; @@ -165,7 +166,6 @@ import lucee.runtime.search.SearchEngine; import lucee.runtime.security.SecurityManager; import lucee.runtime.security.SecurityManagerImpl; -import lucee.runtime.spooler.SpoolerEngineImpl; import lucee.runtime.tag.listener.TagListener; import lucee.runtime.type.Array; import lucee.runtime.type.Collection.Key; @@ -310,11 +310,6 @@ synchronized static void load(ConfigServerImpl config, Struct root, boolean isRe Log log = config.getLog("application"); - if (!essentialOnly) { - _loadResourceProvider(config, root, log); - if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "loaded resource providers"); - } - _loadFilesystem(config, root, doNew, log); // load this before execute any code, what for example loadxtension does (json) if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "loaded filesystem"); @@ -338,9 +333,6 @@ synchronized static void load(ConfigServerImpl config, Struct root, boolean isRe _loadSetting(config, root, log); if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "loaded setting"); - _loadRemoteClient(config, root, log); - if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "loaded remote clients"); - settings(config, log); if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "loaded settings2"); @@ -401,10 +393,8 @@ private static Struct reload(Struct root, ConfigImpl config, ConfigServerImpl cs return root; } - private static void _loadResourceProvider(ConfigServerImpl config, Struct root, Log log) { + public static ResourceProvider loadDefaultResourceProvider(ConfigImpl config, Struct root, Log log) { try { - config.clearResourceProviders(); - Array providers = ConfigWebUtil.getAsArray("resourceProviders", root); Array defaultProviders = ConfigWebUtil.getAsArray("defaultResourceProvider", root); // Default Resource Provider @@ -417,7 +407,7 @@ private static void _loadResourceProvider(ConfigServerImpl config, Struct root, // class if (defProv.hasClass()) { - config.setDefaultResourceProvider(defProv.getClazz(), toArguments(defaultProvider, "arguments", true, false)); + return toDefaultResourceProvider(defProv.getClazz(), toArguments(defaultProvider, "arguments", true, false)); } // component @@ -425,9 +415,31 @@ else if (!StringUtil.isEmpty(strDefaultProviderComponent)) { strDefaultProviderComponent = strDefaultProviderComponent.trim(); Map args = toArguments(defaultProvider, "arguments", true, false); args.put("component", strDefaultProviderComponent); - config.setDefaultResourceProvider(CFMLResourceProvider.class, args); + return toDefaultResourceProvider(CFMLResourceProvider.class, args); } } + } + catch (Throwable t) { + ExceptionUtil.rethrowIfNecessary(t); + log(config, log, t); + } + return null; + } + + private static ResourceProvider toDefaultResourceProvider(Class defaultProviderClass, Map arguments) throws ClassException { + Object o = ClassUtil.loadInstance(defaultProviderClass); + if (o instanceof ResourceProvider) { + ResourceProvider rp = (ResourceProvider) o; + rp.init(null, arguments); + return rp; + } + else throw new ClassException("object [" + Caster.toClassName(o) + "] must implement the interface " + ResourceProvider.class.getName()); + } + + public static void loadResourceProvider(ConfigImpl config, Struct root, Log log) { + try { + Array providers = ConfigWebUtil.getAsArray("resourceProviders", root); + // Resource Provider boolean hasZip = false; if (providers != null && providers.size() > 0) { @@ -2438,25 +2450,18 @@ private static void _loadSetting(ConfigServerImpl config, Struct root, Log log) } } - private static void _loadRemoteClient(ConfigServerImpl config, Struct root, Log log) { + public static RemoteClient[] loadRemoteClients(ConfigImpl config, Struct root, Log log) { + java.util.List list = new ArrayList(); try { boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_REMOTE); - // SNSN - // RemoteClientUsage - Struct _clients = ConfigWebUtil.getAsStruct("remoteClients", root); - // max-threads - int maxThreads = Caster.toIntValue(getAttr(_clients, "maxThreads"), -1); - if (maxThreads < 1) maxThreads = 20; - Array clients = null; Struct client; if (hasAccess && _clients != null) clients = ConfigWebUtil.getAsArray("remoteClient", _clients); - java.util.List list = new ArrayList(); if (clients != null) { Iterator it = clients.getIterator(); while (it.hasNext()) { @@ -2503,28 +2508,13 @@ private static void _loadRemoteClient(ConfigServerImpl config, Struct root, Log } } - if (list.size() > 0) config.setRemoteClients(list.toArray(new RemoteClient[list.size()])); - else config.setRemoteClients(new RemoteClient[0]); - - // init spooler engine - Resource dir = config.getRemoteClientDirectory(); - if (dir != null && !dir.exists()) dir.mkdirs(); - - SpoolerEngineImpl se = (SpoolerEngineImpl) config.getSpoolerEngine(); - if (se == null) { - config.setSpoolerEngine(se = new SpoolerEngineImpl(dir, "Remote Client Spooler", ThreadLocalPageContext.getLog(config, "remoteclient"), maxThreads)); - } - else { - se.setLog(ThreadLocalPageContext.getLog(config, "remoteclient")); - se.setPersisDirectory(dir); - se.setMaxThreads(maxThreads); - } - } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); log(config, log, t); } + + return list.toArray(new RemoteClient[list.size()]); } public static PrintStream loadErr(ConfigImpl config, Struct root, Log log) { diff --git a/core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java b/core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java index 377c16aa30..7416c129b6 100755 --- a/core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java +++ b/core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java @@ -49,6 +49,7 @@ import lucee.runtime.exp.PageException; import lucee.runtime.op.Caster; import lucee.runtime.op.Duplicator; +import lucee.runtime.tag.Admin; import lucee.runtime.type.Array; import lucee.runtime.type.Collection; import lucee.runtime.type.Query; @@ -78,25 +79,23 @@ public class SpoolerEngineImpl implements SpoolerEngine { private final SerializableObject token = new SerializableObject(); private SpoolerThread thread; // private ExecutionPlan[] plans; - private Resource _persisDirectory; private long count = 0; - private Log log; + private Log logX; private int add = 0; - private Resource closedDirectory; - private Resource openDirectory; + // private Resource closedDirectory; + // private Resource openDirectory; - private int maxThreads; + // private int maxThreads; private boolean init; - public SpoolerEngineImpl(Resource persisDirectory, String label, Log log, int maxThreads) { - this._persisDirectory = persisDirectory; - closedDirectory = persisDirectory.getRealResource("closed"); - openDirectory = persisDirectory.getRealResource("open"); - this.maxThreads = maxThreads; + private Config config; + + public SpoolerEngineImpl(Config config, String label) { + + this.config = config; this.label = label; - this.log = log; } public void init(ConfigWeb config) { @@ -105,20 +104,11 @@ public void init(ConfigWeb config) { init = true; } - /* - * private void calculateSize() { closedCount=calculateSize(closedDirectory); - * openCount=calculateSize(openDirectory); } - */ - - public void setMaxThreads(int maxThreads) { - this.maxThreads = maxThreads; - } - /** * @return the maxThreads */ public int getMaxThreads() { - return maxThreads; + return Admin.getConfigServerImpl(config).getRemoteClientMaxThreads(); } private int calculateSize(Resource res) { @@ -250,8 +240,8 @@ private void log(ConfigWeb config, SpoolerTask task, Exception e, boolean before SpoolerTaskListener listener = taskp.getListener(); if (listener != null) listener.listen(config, e, before); } - if (e == null) log.log(Log.LEVEL_INFO, "remote-client", "successfully executed: " + task.subject()); - else log.log(Log.LEVEL_ERROR, "remote-client", "failed to execute: " + task.subject(), e); + if (e == null) LogUtil.logx(config, Log.LEVEL_INFO, "remote-client", "successfully executed: " + task.subject(), "remoteclient", "application"); + else LogUtil.log(config, "remote-client", e, Log.LEVEL_ERROR, "remoteclient", "application"); } private Resource getFile(ConfigWeb config, SpoolerTask task) { @@ -292,12 +282,20 @@ public long calculateNextExecution(SpoolerTask task) { @Override public Query getOpenTasksAsQuery(int startrow, int maxrow) throws PageException { - return getTasksAsQuery(createQuery(), openDirectory, startrow, maxrow); + return getTasksAsQuery(createQuery(), getOpenDirectory(), startrow, maxrow); + } + + private Resource getOpenDirectory() { + return config.getRemoteClientDirectory().getRealResource("open"); + } + + private Resource getClosedDirectory() { + return config.getRemoteClientDirectory().getRealResource("closed"); } @Override public Query getClosedTasksAsQuery(int startrow, int maxrow) throws PageException { - return getTasksAsQuery(createQuery(), closedDirectory, startrow, maxrow); + return getTasksAsQuery(createQuery(), getClosedDirectory(), startrow, maxrow); } @Override @@ -306,7 +304,7 @@ public Query getAllTasksAsQuery(int startrow, int maxrow) throws PageException { Query query = createQuery(); // print.o(startrow+":"+maxrow); - getTasksAsQuery(query, openDirectory, startrow, maxrow); + getTasksAsQuery(query, getOpenDirectory(), startrow, maxrow); int records = query.getRecordcount(); // no open tasks if (records == 0) { @@ -317,18 +315,18 @@ public Query getAllTasksAsQuery(int startrow, int maxrow) throws PageException { startrow = 1; maxrow -= records; } - if (maxrow > 0) getTasksAsQuery(query, closedDirectory, startrow, maxrow); + if (maxrow > 0) getTasksAsQuery(query, getClosedDirectory(), startrow, maxrow); return query; } @Override public int getOpenTaskCount() { - return calculateSize(openDirectory); + return calculateSize(getOpenDirectory()); } @Override public int getClosedTaskCount() { - return calculateSize(closedDirectory); + return calculateSize(getClosedDirectory()); } private Query getTasksAsQuery(Query qry, Resource dir, int startrow, int maxrow) { @@ -459,11 +457,11 @@ public void run() { while (getOpenTaskCount() > 0) { adds = engine.adds(); - taskNames = openDirectory.list(FILTER); + taskNames = getOpenDirectory().list(FILTER); // tasks=engine.getOpenTasks(); nextExection = Long.MAX_VALUE; for (int i = 0; i < taskNames.length; i++) { - task = getTaskByName(openDirectory, taskNames[i]); + task = getTaskByName(getOpenDirectory(), taskNames[i]); if (task == null) continue; if (task.nextExecution() <= System.currentTimeMillis()) { @@ -568,11 +566,11 @@ public void remove(ConfigWeb config, SpoolerTask task) { } public void removeAll() { - ResourceUtil.removeChildrenEL(openDirectory, false); - ResourceUtil.removeChildrenEL(closedDirectory, false); + ResourceUtil.removeChildrenEL(getOpenDirectory(), false); + ResourceUtil.removeChildrenEL(getOpenDirectory(), false); SystemUtil.wait(this, 100); - ResourceUtil.removeChildrenEL(openDirectory, false); - ResourceUtil.removeChildrenEL(closedDirectory, false); + ResourceUtil.removeChildrenEL(getOpenDirectory(), false); + ResourceUtil.removeChildrenEL(getOpenDirectory(), false); } public int adds() { @@ -582,8 +580,8 @@ public int adds() { @Override public void remove(String id) { - SpoolerTask task = getTaskById(openDirectory, id); - if (task == null) task = getTaskById(closedDirectory, id); + SpoolerTask task = getTaskById(getOpenDirectory(), id); + if (task == null) task = getTaskById(getOpenDirectory(), id); if (task != null) remove(task); } @@ -599,8 +597,8 @@ public void remove(String id) { */ @Override public PageException execute(String id) { - SpoolerTask task = getTaskById(openDirectory, id); - if (task == null) task = getTaskById(closedDirectory, id); + SpoolerTask task = getTaskById(getOpenDirectory(), id); + if (task == null) task = getTaskById(getOpenDirectory(), id); if (task != null) { return execute(task); } @@ -651,21 +649,9 @@ public void setLabel(String label) { this.label = label; } - public void setPersisDirectory(Resource persisDirectory) { - this._persisDirectory = persisDirectory; - } - public Resource getPersisDirectory(ConfigWeb config) { - if (_persisDirectory == null) { - _persisDirectory = config.getRemoteClientDirectory(); - } - return _persisDirectory; - } - - public void setLog(Log log) { - this.log = log; + return config.getRemoteClientDirectory(); } - } class TaskFileFilter implements ResourceNameFilter { diff --git a/core/src/main/java/lucee/runtime/tag/Admin.java b/core/src/main/java/lucee/runtime/tag/Admin.java index a0be9d22cb..401106fc49 100755 --- a/core/src/main/java/lucee/runtime/tag/Admin.java +++ b/core/src/main/java/lucee/runtime/tag/Admin.java @@ -2288,6 +2288,7 @@ private void doUpdateTaskSetting() throws PageException { } admin.setTaskMaxThreads(i); store(); + getConfigServerImpl(config).resetRemoteClientMaxThreads(); adminSync.broadcast(attributes, config); } @@ -2825,6 +2826,7 @@ private void doRemoveResourceProvider() throws PageException { admin.removeResourceProvider(getString("admin", action, "scheme")); store(); + getConfigServerImpl(config).resetResources(); adminSync.broadcast(attributes, config); } @@ -2844,6 +2846,7 @@ private void doUpdateResourceProvider() throws PageException { // admin.updateResourceProvider(scheme,clazz,arguments); store(); + getConfigServerImpl(config).resetResources(); adminSync.broadcast(attributes, config); } @@ -3017,6 +3020,7 @@ private static boolean terminateRunningThread(ConfigWeb configWeb, int id) { private void doRemoveRemoteClient() throws PageException { admin.removeRemoteClient(getString("admin", action, "url")); store(); + getConfigServerImpl(config).resetRemoteClients(); } private void doRemoveSpoolerTask() throws PageException { @@ -4851,14 +4855,13 @@ private void doRemoveFLD() throws PageException { } private void doUpdateRemoteClient() throws PageException { - admin.updateRemoteClient(getString("admin", action, "label"), getString("admin", action, "url"), getString("admin", action, "remotetype"), getString("admin", action, "securityKey"), getString("admin", action, "usage"), getString("admin", action, "adminPassword"), getString("ServerUsername", ""), getString("ServerPassword", ""), getString("proxyServer", ""), getString("proxyUsername", ""), getString("proxyPassword", ""), getString("proxyPort", "") ); - store(); + getConfigServerImpl(config).resetRemoteClients(); } private void doReadBundle() throws PageException { diff --git a/loader/build.xml b/loader/build.xml index 3bc03786af..3f84cca93b 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index dec04cb918..bfc7f146c2 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 7.0.0.43-SNAPSHOT + 7.0.0.44-SNAPSHOT jar Lucee Loader Build