Skip to content

Commit

Permalink
temporary change: extend the lock in PageSource to cover all PageSour…
Browse files Browse the repository at this point in the history
…ce instances using the same lock name.
  • Loading branch information
michaeloffner committed Dec 6, 2024
1 parent 229e427 commit cd80810
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/src/main/java/lucee/runtime/PageSourceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit cd80810

Please sign in to comment.