public boolean waitForIdentified()

in tchannel-core/src/main/java/com/uber/tchannel/channels/Connection.java [178:201]


    public boolean waitForIdentified(long timeout) {
        synchronized (lock) {
            // TODO reap connections/peers on init timeout
            try {
                if (this.state != ConnectionState.IDENTIFIED) {
                    this.lastError = null;
                    lock.wait(timeout);
                }
            } catch (InterruptedException ex) {
                // doesn't matter if we got interrupted here ...
                // set interrupt flag
                Thread.currentThread().interrupt();
                logger.warn("wait for identified is interrupted.", ex);
            }

            boolean result = this.state == ConnectionState.IDENTIFIED;
            if (!result) {
                // reset the connection if it failed to identify
                this.clean();
            }

            return result;
        }
    }