Skip to content

Commit 6a1efc5

Browse files
authored
[CSAPI] Make thread pool size configurable (opensensorhub#328)
1 parent 1380074 commit 6a1efc5

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎sensorhub-service-consys/src/main/java/org/sensorhub/impl/service/consys/ConSysApiService.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected void doStart() throws SensorHubException
158158

159159
// init thread pool
160160
threadPool = Executors.newScheduledThreadPool(
161-
Runtime.getRuntime().availableProcessors(),
161+
config.threadPoolSize <= 0 ? Runtime.getRuntime().availableProcessors() : config.threadPoolSize,
162162
new NamedThreadFactory("CSApi-Pool"));
163163

164164
// init timeout monitor

‎sensorhub-service-consys/src/main/java/org/sensorhub/impl/service/consys/ConSysApiServiceConfig.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public class ConSysApiServiceConfig extends OGCServiceConfig
7979
public List<String> uriPrefixMap = new ArrayList<>();
8080

8181

82+
@DisplayInfo(label="Thread Pool Size", desc="Number of threads used by the service to handle incoming requests. " +
83+
"When this value is <= 0, the size of the thread pool will be equal to the available number of CPU processors.")
84+
public int threadPoolSize = 0;
85+
86+
8287
public ConSysApiServiceConfig()
8388
{
8489
this.moduleClass = ConSysApiService.class.getCanonicalName();

0 commit comments

Comments
 (0)