You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2021/03/23 07:50:07 UTC
[mina-sshd] 01/02: [SSHD-1148] Generate a unique thread name for
each SftpSubsystem instance
This is an automated email from the ASF dual-hosted git repository.
lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 183286327a2212f8a7cb7c7fcb3c7372e4d50ef7
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Tue Mar 23 09:30:39 2021 +0200
[SSHD-1148] Generate a unique thread name for each SftpSubsystem instance
---
CHANGES.md | 3 ++-
.../src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 8db2755..0255d8d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -30,6 +30,7 @@
* [SSHD-1111](https://issues.apache.org/jira/browse/SSHD-1111) Fixed SshClientCliSupport compression option detection
* [SSHD-1125](https://issues.apache.org/jira/browse/SSHD-1125) Added option to require immediate close of channel in command `ExitCallback` invocation
* [SSHD-1127](https://issues.apache.org/jira/browse/SSHD-1127) Consolidated `SftpSubsystem` support implementations into `SftpSubsystemConfigurator`
+* [SSHD-1148](https://issues.apache.org/jira/browse/SSHD-1148) Generate a unique thread name for each `SftpSubsystem` instance
## Behavioral changes and enhancements
@@ -49,4 +50,4 @@
* [SSHD-1127](https://issues.apache.org/jira/browse/SSHD-1127) Added capability to register a custom receiver for SFTP STDERR channel raw or stream data
* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for parsing incoming commands to the `ScpShell`
* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for returning environment variables related data from the `ScpShell`
-* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for handling the SCP protocol textual commands and responses
\ No newline at end of file
+* [SSHD-1133](https://issues.apache.org/jira/browse/SSHD-1133) Added capability to specify a custom charset for handling the SCP protocol textual commands and responses
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
index 923ff94..c18714d 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
@@ -88,7 +88,6 @@ public class SftpSubsystem
extends AbstractSftpSubsystemHelper
implements Command, Runnable, FileSystemAware, ExecutorServiceCarrier,
AsyncCommand, ChannelDataReceiver {
-
protected static final Buffer CLOSE = new ByteArrayBuffer(null, 0, 0);
protected final AtomicBoolean closed = new AtomicBoolean(false);
@@ -122,7 +121,9 @@ public class SftpSubsystem
CloseableExecutorService executorService = configurator.getExecutorService();
if (executorService == null) {
- this.executorService = ThreadUtils.newSingleThreadExecutor(getClass().getSimpleName());
+ // See SSHD-1148 - use different thread name for concurrently running instances
+ this.executorService = ThreadUtils.newSingleThreadExecutor(
+ getClass().getSimpleName() + "-" + Math.abs(System.nanoTime() & 0xFFFF));
} else {
this.executorService = executorService;
}