diff --git a/core/src/main/java/lucee/runtime/PageSourceImpl.java b/core/src/main/java/lucee/runtime/PageSourceImpl.java index fb92ebf4f0..c334b781b4 100755 --- a/core/src/main/java/lucee/runtime/PageSourceImpl.java +++ b/core/src/main/java/lucee/runtime/PageSourceImpl.java @@ -210,7 +210,7 @@ public PageSource getParent() { } @Override - public synchronized Page loadPage(PageContext pc, boolean forceReload) throws PageException { + public Page loadPage(PageContext pc, boolean forceReload) throws PageException { if (forceReload) pcn.reset(); Page page = pcn.page; @@ -229,7 +229,7 @@ public synchronized Page loadPage(PageContext pc, boolean forceReload) throws Pa } @Override - public synchronized Page loadPageThrowTemplateException(PageContext pc, boolean forceReload, Page defaultValue) throws TemplateException { + public Page loadPageThrowTemplateException(PageContext pc, boolean forceReload, Page defaultValue) throws TemplateException { if (forceReload) pcn.reset(); Page page = pcn.page; @@ -247,7 +247,7 @@ public synchronized Page loadPageThrowTemplateException(PageContext pc, boolean } @Override - public synchronized Page loadPage(PageContext pc, boolean forceReload, Page defaultValue) { + public Page loadPage(PageContext pc, boolean forceReload, Page defaultValue) { if (forceReload) pcn.reset(); Page page = pcn.page; @@ -278,17 +278,19 @@ public synchronized Page loadPage(PageContext pc, boolean forceReload, Page defa private Page loadArchive(Page page) { if (!mapping.hasArchive()) return null; if (page != null && page.getLoadType() == LOAD_ARCHIVE) return page; - try { - Class clazz = mapping.getArchiveClass(getClassName()); - page = newInstance(clazz); - page.setPageSource(this); - page.setLoadType(LOAD_ARCHIVE); - pcn.set(page); - return page; - } - catch (Exception e) { - // MUST print.e(e); is there a better way? - return null; + synchronized (this) { + try { + Class clazz = mapping.getArchiveClass(getClassName()); + page = newInstance(clazz); + page.setPageSource(this); + page.setLoadType(LOAD_ARCHIVE); + pcn.set(page); + return page; + } + catch (Exception e) { + // MUST print.e(e); is there a better way? + return null; + } } } @@ -315,27 +317,33 @@ private Page loadPhysical(PageContext pc, Page page) throws TemplateException { if (page != null) { // if(page!=null && !recompileAlways) { if (srcLastModified != page.getSourceLastModified()) { - // same size, maybe the content has not changed? - boolean same = false; - if (page instanceof PagePro && ((PagePro) page).getSourceLength() == srcFile.length()) { - PagePro pp = (PagePro) page; - try { - same = pp.getHash() == PageSourceCode.toString(this, config.getTemplateCharset()).hashCode(); - } - catch (IOException e) { - } + synchronized (this) { + if (srcLastModified != page.getSourceLastModified()) { + // same size, maybe the content has not changed? + boolean same = false; + if (page instanceof PagePro && ((PagePro) page).getSourceLength() == srcFile.length()) { + PagePro pp = (PagePro) page; + try { + same = pp.getHash() == PageSourceCode.toString(this, config.getTemplateCharset()).hashCode(); + } + catch (IOException e) { + } - } - if (!same) { - LogUtil.log(pc, Log.LEVEL_DEBUG, "compile", "recompile [" + getDisplayPath() + "] because loaded page has changed"); - pcn.set(page = compile(config, mapping.getClassRootDirectory(), page, false, pc.ignoreScopes())); - page.setPageSource(this); + } + if (!same) { + LogUtil.log(pc, Log.LEVEL_DEBUG, "compile", "recompile [" + getDisplayPath() + "] because loaded page has changed"); + pcn.set(page = compile(config, mapping.getClassRootDirectory(), page, false, pc.ignoreScopes())); + page.setPageSource(this); + } + } } } page.setLoadType(LOAD_PHYSICAL); + pci.setPageUsed(page); + return page; } // page doesn't exist - else { + synchronized (this) { Resource classRootDir = mapping.getClassRootDirectory(); Resource classFile = classRootDir.getRealResource(getJavaName() + ".class"); boolean isNew = false; diff --git a/loader/build.xml b/loader/build.xml index 85bc523989..a572ec69e3 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index 26a30e5a48..d5bbc1afe4 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 5.4.3.6-SNAPSHOT + 5.4.3.7-SNAPSHOT jar Lucee Loader Build