Skip to content

Commit

Permalink
add some static/temporary logging to see what is going on
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 17, 2024
1 parent c78bce1 commit 975d192
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Locale;
import java.util.TimeZone;

import lucee.print;
import lucee.commons.io.log.Log;
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
Expand Down Expand Up @@ -53,14 +54,17 @@ public final class ThreadLocalPageContext {
*/
public static void register(PageContext pc) {// print.ds(Thread.currentThread().getName());
if (pc == null) {
print.e(Thread.currentThread() + " register: null");
return; // TODO happens with Gateway, but should not!
}
print.e(Thread.currentThread() + " do register: " + pc.getId());
// TODO should i set the old one by "release"?
Thread t = Thread.currentThread();
t.setContextClassLoader(((ConfigPro) pc.getConfig()).getClassLoaderEnv());
((PageContextImpl) pc).setThread(t);
pcThreadLocal.set(pc);
pcThreadLocalInheritable.set(pc);
print.e(Thread.currentThread() + " registered: " + pc.getId());
}

public static PageContext get() {
Expand Down Expand Up @@ -106,9 +110,13 @@ public static Config getConfig() {
/**
* release the pagecontext for the current thread
*/
public static void release() {// print.ds(Thread.currentThread().getName());
public static void release() {
PageContext dodelete = get();
if (dodelete != null) print.e(Thread.currentThread() + " do release: " + dodelete.getId());
else print.e(Thread.currentThread() + " do release: null");
pcThreadLocal.set(null);
pcThreadLocalInheritable.set(null);
print.e(Thread.currentThread() + " released");
}

public static Config getConfig(PageContext pc) {
Expand Down

0 comments on commit 975d192

Please sign in to comment.