Skip to content

Commit

Permalink
Use workaround to fix high CPU usage by LinkedTransferQueue (#3756)
Browse files Browse the repository at this point in the history
This is a workaround for JDK-8301341 by using the Java 11 LinkedTransferQueue with the QueueingThreadPoolExecutor in the Core and jUPnP.

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored Aug 14, 2023
1 parent c12067a commit aef57ed
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 31 deletions.
11 changes: 10 additions & 1 deletion bom/compile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@
<dependency>
<groupId>org.jupnp</groupId>
<artifactId>org.jupnp</artifactId>
<version>2.7.1</version>
<!-- Uses the Java 11 LinkedTransferQueue as workaround for JDK-8301341 -->
<version>2.7.1.OH1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -436,6 +437,14 @@
<version>5.12.1</version>
<scope>compile</scope>
</dependency>

<!-- Provides the Java 11 LinkedTransferQueue used in workarounds for JDK-8301341 -->
<dependency>
<groupId>org.openhab</groupId>
<artifactId>base-fixes</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
11 changes: 10 additions & 1 deletion bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@
<dependency>
<groupId>org.jupnp</groupId>
<artifactId>org.jupnp</artifactId>
<version>2.7.1</version>
<!-- Uses the Java 11 LinkedTransferQueue as workaround for JDK-8301341 -->
<version>2.7.1.OH1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -1090,6 +1091,14 @@
<version>5.12.1</version>
<scope>compile</scope>
</dependency>

<!-- Provides the Java 11 LinkedTransferQueue used in workarounds for JDK-8301341 -->
<dependency>
<groupId>org.openhab</groupId>
<artifactId>base-fixes</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.openhab.core.common;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
Expand All @@ -24,6 +23,7 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Consumer;

import org.openhab.basefixes.util.concurrent.LinkedTransferQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
1 change: 1 addition & 0 deletions features/karaf/openhab-core/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<requirement>openhab.tp;filter:="(feature=jna)"</requirement>
<feature dependency="true">openhab.tp-jna</feature>

<bundle>mvn:org.openhab/base-fixes/1.0.0</bundle>
<bundle>mvn:org.openhab.core.bundles/org.openhab.core.automation/${project.version}</bundle>
<bundle>mvn:org.openhab.core.bundles/org.openhab.core.config.core/${project.version}</bundle>
<bundle>mvn:org.openhab.core.bundles/org.openhab.core.config.discovery/${project.version}</bundle>
Expand Down
3 changes: 2 additions & 1 deletion features/karaf/openhab-tp/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@
<feature dependency="true">http</feature>
<feature dependency="true">scr</feature>
<feature dependency="true">openhab.tp-httpclient</feature>
<bundle>mvn:org.jupnp/org.jupnp/2.7.1</bundle>
<bundle>mvn:org.openhab/base-fixes/1.0.0</bundle>
<bundle>mvn:org.jupnp/org.jupnp/2.7.1.OH1</bundle>
</feature>

<feature name="openhab.tp-lsp4j" description="Eclipse LSP4J" version="${project.version}">
Expand Down
3 changes: 2 additions & 1 deletion itests/org.openhab.core.addon.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ Fragment-Host: org.openhab.core.addon
org.openhab.core.addon;version='[4.1.0,4.1.1)',\
org.openhab.core.addon.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.config.core;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ Fragment-Host: org.openhab.core.auth.oauth2client
org.openhab.core.auth.oauth2client.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.io.net;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.automation
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.automation
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ Fragment-Host: org.openhab.core.automation.module.script
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.automation
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.automation.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.automation
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.config.core.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ Fragment-Host: org.openhab.core.config.core
org.openhab.core;version='[4.1.0,4.1.1)',\
org.openhab.core.config.core;version='[4.1.0,4.1.1)',\
org.openhab.core.config.core.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.config.discovery.mdns
org.openhab.core.io.transport.mdns;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.config.discovery.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ Fragment-Host: org.openhab.core.config.discovery
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Fragment-Host: org.openhab.core.config.discovery.usbserial.linuxsysfs
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ Provide-Capability: \
org.openhab.core.io.console;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.config.dispatch.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ Fragment-Host: org.openhab.core.config.dispatch
org.openhab.core;version='[4.1.0,4.1.1)',\
org.openhab.core.config.dispatch;version='[4.1.0,4.1.1)',\
org.openhab.core.config.dispatch.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.ephemeris.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ feature.openhab-config: \
org.openhab.core.config.core;version='[4.1.0,4.1.1)',\
org.openhab.core.ephemeris;version='[4.1.0,4.1.1)',\
org.openhab.core.ephemeris.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.io.net.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ Fragment-Host: org.openhab.core.io.net
org.openhab.core;version='[4.1.0,4.1.1)',\
org.openhab.core.io.net;version='[4.1.0,4.1.1)',\
org.openhab.core.io.net.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)'
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.io.rest.core.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ Fragment-Host: org.openhab.core.io.rest.core
org.openhab.core.semantics;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
6 changes: 4 additions & 2 deletions itests/org.openhab.core.model.item.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ Fragment-Host: org.openhab.core.model.item
org.openhab.core.model.item.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.model.persistence;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.sitemap;version='[4.1.0,4.1.1)',\
Expand All @@ -114,4 +113,7 @@ Fragment-Host: org.openhab.core.model.item
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.core.voice;version='[4.1.0,4.1.1)'
org.openhab.core.voice;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.openhab.core.model.thing.runtime;version='[4.1.0,4.1.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
5 changes: 4 additions & 1 deletion itests/org.openhab.core.model.rule.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@ Fragment-Host: org.openhab.core.model.rule.runtime
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.core.voice;version='[4.1.0,4.1.1)'
org.openhab.core.voice;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.openhab.core.model.thing.runtime;version='[4.1.0,4.1.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
5 changes: 3 additions & 2 deletions itests/org.openhab.core.model.script.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Fragment-Host: org.openhab.core.model.script
org.openhab.core.model.item;version='[4.1.0,4.1.1)',\
org.openhab.core.model.persistence;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script.tests;version='[4.1.0,4.1.1)',\
Expand All @@ -121,4 +120,6 @@ Fragment-Host: org.openhab.core.model.script
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.core.voice;version='[4.1.0,4.1.1)'
org.openhab.core.voice;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.openhab.core.model.thing.runtime;version='[4.1.0,4.1.1)'
5 changes: 3 additions & 2 deletions itests/org.openhab.core.model.thing.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Fragment-Host: org.openhab.core.model.thing
org.openhab.core.model.item.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.persistence;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule;version='[4.1.0,4.1.1)',\
org.openhab.core.model.rule.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script;version='[4.1.0,4.1.1)',\
org.openhab.core.model.script.runtime;version='[4.1.0,4.1.1)',\
org.openhab.core.model.sitemap;version='[4.1.0,4.1.1)',\
Expand All @@ -123,4 +122,6 @@ Fragment-Host: org.openhab.core.model.thing
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.core.voice;version='[4.1.0,4.1.1)'
org.openhab.core.voice;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.storage.json.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ Fragment-Host: org.openhab.core.storage.json
org.openhab.core.storage.json.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
4 changes: 3 additions & 1 deletion itests/org.openhab.core.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ Fragment-Host: org.openhab.core
org.objenesis;version='[3.3.0,3.3.1)',\
org.openhab.core;version='[4.1.0,4.1.1)',\
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.tests;version='[4.1.0,4.1.1)'
org.openhab.core.tests;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)',\
org.osgi.service.cm;version='[1.6.0,1.6.1)'
3 changes: 2 additions & 1 deletion itests/org.openhab.core.thing.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ Fragment-Host: org.openhab.core.thing
org.openhab.core.test;version='[4.1.0,4.1.1)',\
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.thing.tests;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)'
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)'
3 changes: 2 additions & 1 deletion itests/org.openhab.core.voice.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ Fragment-Host: org.openhab.core.voice
org.openhab.core.thing;version='[4.1.0,4.1.1)',\
org.openhab.core.transform;version='[4.1.0,4.1.1)',\
org.openhab.core.voice;version='[4.1.0,4.1.1)',\
org.openhab.core.voice.tests;version='[4.1.0,4.1.1)'
org.openhab.core.voice.tests;version='[4.1.0,4.1.1)',\
org.openhab.base-fixes;version='[1.0.0,1.0.1)'

0 comments on commit aef57ed

Please sign in to comment.