public AdminClient checkout ( ) { if ( isClosed . get ( ) ) { throw new IllegalStateException ( "Pool is closing" ) ; } AdminClient client ; // Try to get one from the Cache. while ( ( client = clientCache . poll ( ) ) != null ) { if ( ! client . isClusterModified ( ) ) { return client ; } else { // Cluster is Modified, after the AdminClient is created. Close it client . close ( ) ; } } // None is available, create new one. return createAdminClient ( ) ; }
get an AdminClient from the cache if exists if not create new one and return it . This method is non - blocking .