src/main/java/org/apache/dubbo/remoting/etcd/jetcd/JEtcdClientWrapper.java
/**
     * try to check if path exists.
     */
try to check if path exists.
try to check if path exists .
public boolean checkExists(String path) {
        for (; ; ) {
            try {
                return client.getKVClient()
                        .get(ByteSequence.fromString(path), GetOption.newBuilder().withCountOnly(true).build())
                        .get().getCount() > 0;
            } catch (Exception e) {
                Status status = Status.fromThrowable(e);
                if (status != null && status.getCode() == Status.Code.UNKNOWN) {
                    throw new IllegalStateException("failed to check exists by path '" + path + "'", e);
                }
                if (OptionUtil.isRecoverable(status)) {
                    LockSupport.parkNanos(this, TimeUnit.MILLISECONDS.toNanos(50));
                    continue;
                }
                throw new IllegalStateException(e.getMessage(), e);
            }
        }
    }
public boolean checkExists ( String path ) { for ( ; ; ) { try { return client . getKVClient ( ) . get ( ByteSequence . fromString ( path ) , GetOption . newBuilder ( ) . withCountOnly ( true ) . build ( ) ) . get ( ) . getCount ( ) > 0 ; } catch ( Exception e ) { Status status = Status . fromThrowable ( e ) ; if ( status != null && status . getCode ( ) == Status . Code . UNKNOWN ) { throw new IllegalStateException ( "failed to check exists by path '" + path + "'" , e ) ; } if ( OptionUtil . isRecoverable ( status ) ) { LockSupport . parkNanos ( this , TimeUnit . MILLISECONDS . toNanos ( 50 ) ) ; continue ; } throw new IllegalStateException ( e . getMessage ( ) , e ) ; } } }
try to check if path exists.
try to check if path exists .