Skip to content

Commit

Permalink
change the queue type in debug pool
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Sep 6, 2024
1 parent da54c86 commit 7b70f63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
28 changes: 13 additions & 15 deletions core/src/main/java/lucee/runtime/debug/DebuggerPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
package lucee.runtime.debug;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.runtime.PageContext;
import lucee.runtime.config.ConfigWebPro;
Expand All @@ -32,43 +34,39 @@

public class DebuggerPool {

// private Resource storage;
private LinkedList<Struct> queue = new LinkedList<Struct>();
// private List<Debugger> list=new ArrayList<Debugger>();
// private LinkedList<Struct> queue = new LinkedList<Struct>();
private Queue<Struct> queue = new ConcurrentLinkedQueue<>();

public DebuggerPool(Resource storage) {
// this.storage=storage;
}

public void store(PageContext pc, Debugger debugger) {
public void store(PageContext pc, DebuggerImpl debugger) {
if (ReqRspUtil.getScriptName(pc, pc.getHttpServletRequest()).indexOf("/lucee/") == 0) return;

try {
queue.add(debugger.getDebuggingData(pc, true));
}
catch (PageException e) {
LogUtil.log(pc, "debugger", e);
}

while (queue.size() > ((ConfigWebPro) pc.getConfig()).getDebugMaxRecordsLogged())
// on overflow
while (queue.size() > ((ConfigWebPro) pc.getConfig()).getDebugMaxRecordsLogged()) {
queue.poll();

}
}

public Array getData(PageContext pc) {
Iterator<Struct> it;
synchronized (queue) {
it = queue.iterator();
}
Array arr = new ArrayImpl();
Iterator<Struct> it = queue.iterator();
while (it.hasNext()) {
arr.appendEL(it.next());
}
return arr;
}

public void purge() {
synchronized (queue) {
queue.clear();
}
queue.clear();
}

}
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.81-SNAPSHOT"/>
<property name="version" value="6.2.0.82-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.81-SNAPSHOT</version>
<version>6.2.0.82-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 7b70f63

Please sign in to comment.