Zabee Ulla created SSHD-935:
-------------------------------

             Summary: Synchronizing the Apache Mina client connection between 
thread
                 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


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 the 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. 

How can I synchronize the connection? Is there something in Mina APIs that can 
help in this situation?

SFTPMinaClientConnector.java's connect method.

public void connect(){

try { 
 _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);

NG_DIRECTORY.getCommand().toLowerCase()));
 }
 catch (Exception oie) {
 ....
 }
 }

 

 

Thank you in advance,

Zabee



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to