From cd80810fb96a7185e99b00d74d2ebff645e0155b Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 6 Dec 2024 17:09:26 +0100 Subject: [PATCH] temporary change: extend the lock in PageSource to cover all PageSource instances using the same lock name. --- .../main/java/lucee/runtime/PageSourceImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/lucee/runtime/PageSourceImpl.java b/core/src/main/java/lucee/runtime/PageSourceImpl.java index d380992841..67c39edc99 100755 --- a/core/src/main/java/lucee/runtime/PageSourceImpl.java +++ b/core/src/main/java/lucee/runtime/PageSourceImpl.java @@ -337,7 +337,7 @@ private Page loadPhysical(PageContext pc, Page page) throws TemplateException { if (page != null) { // if(page!=null && !recompileAlways) { if (srcLastModified != page.getSourceLastModified() || (page instanceof PagePro && ((PagePro) page).getSourceLength() != srcFile.length())) { - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (srcLastModified != page.getSourceLastModified() || (page instanceof PagePro && ((PagePro) page).getSourceLength() != srcFile.length())) { // same size, maybe the content has not changed? boolean same = false; @@ -367,7 +367,7 @@ private Page loadPhysical(PageContext pc, Page page) throws TemplateException { Resource classRootDir = mapping.getClassRootDirectory(); Resource classFile = classRootDir.getRealResource(getJavaName() + ".class"); boolean isNew = false; - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { // new class if (flush || !classFile.exists()) { LogUtil.log(pc, Log.LEVEL_DEBUG, "compile", "compile [" + getDisplayPath() + "] no previous class file or flush"); @@ -438,7 +438,7 @@ public boolean releaseWhenOutdatted() { // if(page!=null && !recompileAlways) { if (srcLastModified == 0 || srcLastModified != page.getSourceLastModified()) { // || (page instanceof PagePro && ((PagePro) page).getSourceLength() != srcFile.length()) - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (srcLastModified == 0 || srcLastModified != page.getSourceLastModified()) {// || (page instanceof PagePro && ((PagePro) page).getSourceLength() != // srcFile.length()) if (LogUtil.doesDebug(log)) log.debug("page-source", "release [" + getDisplayPath() + "] from page source pool"); @@ -636,7 +636,7 @@ public Resource getPhyscalFile() { return null; } if (physcalSource == null) { - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (physcalSource == null) { Resource tmp = mapping.getPhysical().getRealResource(relPath); physcalSource = ResourceUtil.toExactResource(tmp); @@ -658,7 +658,7 @@ public Resource getPhyscalFile() { public Resource getArchiveFile() { if (!mapping.hasArchive()) return null; if (archiveSource == null) { - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (archiveSource == null) { String path = "zip://" + mapping.getArchive().getAbsolutePath() + "!" + relPath; archiveSource = ThreadLocalPageContext.getConfig().getResource(path); @@ -672,7 +672,7 @@ public Resource getArchiveClass() { if (!mapping.hasArchive()) return null; if (archiveClass == null) { - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (archiveClass == null) { String path = "zip://" + mapping.getArchive().getAbsolutePath() + "!" + getJavaName() + ".class"; archiveClass = ThreadLocalPageContext.getConfig().getResource(path); @@ -820,7 +820,7 @@ public String getComponentName() { private void createClassAndPackage() { if (className == null) { - synchronized (SystemUtil.createToken("PageSource", getClassName())) { + synchronized (SystemUtil.createToken("PageSource", getRealpathWithVirtual())) { if (className == null) { String str = relPath; StringBuilder packageName = new StringBuilder();