Skip to content

Commit 4393aea

Browse files
authored
Merge pull request #2217 from adamretter/hotfix/thread-groups-and-naming
Fix thread naming
2 parents 1c106f2 + 6ae69e2 commit 4393aea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+991
-534
lines changed

.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<classpathentry kind="src" path="extensions/debuggee/test"/>
2323
<classpathentry kind="src" path="extensions/webdav/src"/>
2424
<classpathentry kind="src" path="extensions/commands/src"/>
25-
<classpathentry kind="lib" path="lib/core/j8fu-1.20.jar"/>
25+
<classpathentry kind="lib" path="lib/core/j8fu-1.21.jar"/>
2626
<classpathentry kind="lib" path="lib/core/icu4j-59_1.jar"/>
2727
<classpathentry kind="lib" path="lib/core/icu4j-localespi-59_1.jar"/>
2828
<classpathentry kind="lib" path="lib/core/pkg-java-fork.jar"/>

extensions/debuggee/src/org/exist/debuggee/ScriptRunner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import org.exist.xquery.CompiledXQuery;
3232
import org.exist.xquery.XQuery;
3333

34+
import static org.exist.util.ThreadUtils.nameInstanceThread;
35+
3436
/**
3537
* @author <a href="mailto:[email protected]">Dmitriy Shabanov</a>
3638
*
@@ -48,7 +50,7 @@ public ScriptRunner(SessionImpl session, CompiledXQuery compiled) {
4850
this.session = session;
4951
expression = compiled;
5052

51-
thread = new Thread(this);
53+
thread = newInstanceThread(BrokerPool.getInstance(), "scriptRunner" this);
5254
thread.setDaemon(true);
5355
thread.setName("Debug session "+compiled.getContext().hashCode());
5456
}

extensions/debuggee/src/org/exist/debugger/DebuggerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
import org.w3c.dom.NodeList;
5151
import org.w3c.dom.Text;
5252

53+
import static org.exist.util.ThreadUtils.newGlobalThread;
54+
5355
/**
5456
* @author <a href="mailto:[email protected]">Dmitriy Shabanov</a>
5557
*
@@ -117,7 +119,7 @@ public DebuggingSource init(String url) throws IOException,
117119
sources = new HashMap<String, DebuggingSource>();
118120
currentTransactionId = 1;
119121

120-
Thread session = new Thread(new HttpSession(this, url));
122+
Thread session = newGlobalThread("debuggerHttpSession" new HttpSession(this, url));
121123
session.start();
122124

123125
// 30s timeout

extensions/fluent/src/org/exist/fluent/Database.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import java.text.MessageFormat;
3131
import java.util.*;
3232

33+
import static org.exist.util.ThreadUtils.newInstanceThread;
34+
3335
/**
3436
* <p>The global entry point to an embedded instance of the <a href='http://exist-db.org'>eXist </a>database.
3537
* The static methods on this class control the lifecycle of the database connection. It follows that
@@ -561,7 +563,7 @@ private static class Defragmenter implements Runnable {
561563

562564
public void start() {
563565
if (thread != null) return;
564-
thread = new Thread(this, "Database defragmenter");
566+
thread = newInstanceThread(pool, "fluent.database-defragmenter", this);
565567
thread.setPriority(Thread.NORM_PRIORITY-3);
566568
thread.setDaemon(true);
567569
thread.start();

extensions/fluent/src/org/exist/fluent/WeakMultiValueHashMap.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.lang.ref.WeakReference;
44
import java.util.*;
55

6+
import static org.exist.util.ThreadUtils.newGlobalThread;
7+
68
class WeakMultiValueHashMap<K,V> {
79

810
/**
@@ -84,7 +86,7 @@ public void remove() {
8486

8587
private static final Sweeper SWEEPER = new Sweeper();
8688
static {
87-
Thread thread = new Thread(SWEEPER, "WeakMultiValueHashMap sweeper");
89+
Thread thread = newGlobalThread("fluent.weakMultiValueHashMap.sweeper", SWEEPER);
8890
thread.setPriority(Thread.NORM_PRIORITY-3);
8991
thread.setDaemon(true);
9092
thread.start();

extensions/modules/src/org/exist/xquery/modules/exi/EXIUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected static InputStream getInputStream(Item item, XQueryContext context) th
5050
Serializer serializer = context.getBroker().newSerializer();
5151

5252
NodeValue node = (NodeValue) item;
53-
return new NodeInputStream(serializer, node);
53+
return new NodeInputStream(context.getBroker().getBrokerPool(), serializer, node);
5454
default:
5555
LOG.error("Wrong item type " + Type.getTypeName(item.getType()));
5656
throw new XPathException("wrong item type " + Type.getTypeName(item.getType()));

lib/core/j8fu-1.20.jar

-189 KB
Binary file not shown.

lib/core/j8fu-1.21.jar

198 KB
Binary file not shown.

nbproject/project.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ file.reference.commons-io-2.6.jar=lib/core/commons-io-2.6.jar
1111
file.reference.commons-lang3-3.7.jar=lib/optional/commons-lang3-3.7.jar
1212
file.reference.commons-net-3.6.jar=lib/optional/commons-net-3.6.jar
1313
file.reference.httpcore-4.4.8.jar=lib/optional/httpcore-4.4.8.jar
14-
file.reference.j8fu-1.20.jar=lib/core/j8fu-1.20.jar
14+
file.reference.j8fu-1.21.jar=lib/core/j8fu-1.21.jar
1515
file.reference.icu4j-59_1.jar=lib/core/icu4j-59_1.jar
1616
file.reference.icu4j-localespi-59_1.jar=lib/core/icu4j-localespi-59_1.jar
1717
file.reference.caffeine-2.6.2.jar=lib/core/caffeine-2.6.2.jar
@@ -368,7 +368,7 @@ javac.classpath=\
368368
${file.reference.tools-java-1.0-SNAPSHOT.jar}:\
369369
${file.reference.tagsoup-1.2.1.jar}:\
370370
${file.reference.exquery-annotations-common-1.0-SNAPSHOT.jar}:\
371-
${file.reference.j8fu-1.20.jar}:\
371+
${file.reference.j8fu-1.21.jar}:\
372372
${file.reference.icu4j-59_1.jar}:\
373373
${file.reference.icu4j-localespi-59_1.jar}:\
374374
${file.reference.caffeine-2.6.2.jar}:\

src/org/exist/Database.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public interface Database {
5858

5959
public String getId();
6060

61+
ThreadGroup getThreadGroup();
62+
6163
/**
6264
*
6365
* @return SecurityManager

0 commit comments

Comments
 (0)