Fix HTTP inbound endpoint creating new worker thread pool for each request
Fixes
@@ -79,6 +79,8 @@ public class InboundHttpSourceHandler extends SourceHandler {
Pattern dispatchPattern = null;
+ // Need to initialize workerPool only once
+ if (workerPool == null) {
WorkerPoolConfiguration workerPoolConfiguration = HTTPEndpointManager.getInstance()
.getWorkerPoolConfiguration(SUPER_TENANT_DOMAIN_NAME, port);
if (workerPoolConfiguration != null) {
@@ -89,11 +91,10 @@ public class InboundHttpSourceHandler extends SourceHandler {
workerPoolConfiguration.getWorkerPoolQueuLength(),
workerPoolConfiguration.getThreadGroupID(),
workerPoolConfiguration.getThreadID());
- }
-
- if (workerPool == null) {
+ } else {
workerPool = sourceConfiguration.getWorkerPool();
}
+ }
Object correlationId = conn.getContext().getAttribute(PassThroughConstants.CORRELATION_ID);
if (correlationId != null) {
@@ -121,5 +122,4 @@ public class InboundHttpSourceHandler extends SourceHandler {
sourceConfiguration.getSourceConnections().shutDownConnection(conn, true);
}
}
-
}
