[
https://issues.apache.org/jira/browse/SSHD-935?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zabee Ulla updated SSHD-935:
----------------------------
Summary: Synchronizing the Apache Mina client connection between threads
(was: Synchronizing the Apache Mina client connection between thread)
> Synchronizing the Apache Mina client connection between threads
> ---------------------------------------------------------------
>
> Key: SSHD-935
> URL: https://issues.apache.org/jira/browse/SSHD-935
> Project: MINA SSHD
> Issue Type: Question
> Affects Versions: 2.2.0
> Reporter: Zabee Ulla
> Priority: Major
>
> I have multiple threads accessing a prototype bean
> SFTPMinaClientConnector.java. Every thread has some random method whose
> entire job is to connect to a remote machine using the
> SFTPMinaClientConnector.java, get the job done and disconnect.
> The problem I am facing is connection synchronization. While one thread is
> still doing some task the other closes it resulting in connection already
> closed exception.
> Looks like every thread is using the same connection.
> Is it possible to get a different connection for every thread? If so, how
> can I do that?
> If not, how can I synchronize the connection? Is there something in Mina
> APIs that can help in this situation?
> Below is the connect() method from my SFTPMinaClientConnector.java through
> which every thread goes in
> public void connect(){
> try {
> SshClient _client = SshClient.setUpDefaultClient();
> _client.start();
> ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
> connectFuture.awaitUninterruptibly();
> _session = connectFuture.getSession();
> _session.addPasswordIdentity(_password);
> shellChannel = _session.createShellChannel();
> _session.auth().verify(30000L);
> if (_session.isAuthenticated())
> { LOG.debug("Authentication succeeded. SFTP channel opened and connected."); }
> sftpClient = SftpClientFactory.instance().createSftpClient(_session);
> }
> catch (Exception oie) \{ .... }
> }
> Thank you in advance,
> Zabee
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]