void handleCommunicationIssue(Exception io) {
        // If we are connecting or disconnecting, note exception and leave
        statusLock.lock();
        try {
            if (this.connecting || this.disconnecting || this.status == Status.CLOSED || this.isDraining()) {
                this.exceptionDuringConnectChange = io;
                return;
            }
        } finally {
            statusLock.unlock();
        }

        processException(io);

        // Spawn a thread so we don't have timing issues with
        // waiting on read/write threads
        executor.submit(() -> {
            try {
                this.closeSocket(true);
            } catch (InterruptedException e) {
                processException(e);
            }
        });
    }
void handleCommunicationIssue ( Exception io ) { statusLock . lock ( ) ; try { if ( this . connecting || this . disconnecting || this . status == Status . CLOSED || this . isDraining ( ) ) { this . exceptionDuringConnectChange = io ; return ; } } finally { statusLock . unlock ( ) ; } processException ( io ) ; executor . submit ( ( ) -> { try { this . closeSocket ( true ) ; } catch ( InterruptedException e ) { processException ( e ) ; } } ) ; }
Called from reader/writer thread