private void closeChannel ( ) { // TODO: race condition between this and the setChannel method. Channel c ; synchronized ( channelLock ) { c = channel ; channel = null ; absoluteRemoteFs = null ; isUnix = null ; } if ( c != null ) { try { c . close ( ) ; } catch ( IOException e ) { logger . log ( Level . SEVERE , "Failed to terminate channel to " + getDisplayName ( ) , e ) ; } for ( ComputerListener cl : ComputerListener . all ( ) ) cl . onOffline ( this , offlineCause ) ; } }
If still connected disconnect .