Hello All!

I am having issues with getting "session is down" and "channel is not
opened" JSchExceptions in my code. When looking at the source I noticed the
following code:

while (this.getRecipient()==-1 && _session.isConnected() && retry>0) {
    if (timeout>0L) {
        if ((System.currentTimeMillis()-start)>timeout) {
            retry=0;
            continue;
        }
    }

    try { Thread.sleep(50); } catch (Exception ee) {}
    retry--;
}

My concern is the getRecipient() call; which simply returns the value of the
member variable "recipient". In the case of the above code, the running
thread is waiting for the async callback thread to call setRecipient() to
signal that the response was received.

Since thread A is waiting on the recipient variable to be mutated by thread
B, shouldn't recipient be volatile to ensure thread A sees the change?

-Dan
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk 
Collect, index and harness all the fast moving IT data generated by your 
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights. 
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to