From 7af51501d5a70e6cdff45d7c1c804f0e820d1d3a Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 11:53:39 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: Thread.run() calls and getters leaking internal state (#847)
---
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
index 5949582..68e2999 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
@@ -14,6 +14,7 @@
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
* Portions Copyright 2025-2026 3A Systems LLC.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.replication.service;
@@ -885,11 +886,11 @@
if (initReqMsg != null)
{
// Do this work in a thread to allow replay thread continue working
- ExportThread exportThread = new ExportThread(
+ ExportTask exportTask = new ExportTask(
initReqMsg.getSenderID(), initReqMsg.getInitWindow());
exportThreadPool.execute(() -> {
- Thread.currentThread().setName(exportThread.getName());
- exportThread.run();
+ Thread.currentThread().setName(exportTask.getName());
+ exportTask.run();
});
}
}
@@ -1039,20 +1040,23 @@
*/
/**
- * This thread is launched when we want to export data to another server.
+ * This task is submitted to the export thread pool when we want to export data to another
+ * server.
*
* When a task is created locally (so this local server is the initiator)
* of the export (Example: dsreplication initialize-all),
- * this thread is NOT used but the task thread is running the export instead).
+ * this task is NOT used but the task thread is running the export instead).
*/
- private class ExportThread extends DirectoryThread
+ private class ExportTask implements Runnable
{
/** Id of server that will be initialized. */
private final int serverIdToInitialize;
private final int initWindow;
+ /** Name given to the pool thread which runs this task. */
+ private final String name;
/**
- * Constructor for the ExportThread.
+ * Constructor for the ExportTask.
*
* @param serverIdToInitialize
* serverId of server that will receive entries
@@ -1060,14 +1064,24 @@
* The value of the initialization window for flow control between
* the importer and the exporter.
*/
- public ExportThread(int serverIdToInitialize, int initWindow)
+ public ExportTask(int serverIdToInitialize, int initWindow)
{
- super("Export thread from serverId=" + getServerId() + " to serverId="
- + serverIdToInitialize);
+ this.name = "Export thread from serverId=" + getServerId() + " to serverId="
+ + serverIdToInitialize;
this.serverIdToInitialize = serverIdToInitialize;
this.initWindow = initWindow;
}
+ /**
+ * Returns the name of this task, used to name the thread running it.
+ *
+ * @return the name of this task
+ */
+ public String getName()
+ {
+ return name;
+ }
+
@Override
public void run()
{
--
Gitblit v1.10.0