public Deferred < String > getNameAsync ( final byte [ ] id ) { if ( id . length != id_width ) { throw new IllegalArgumentException ( "Wrong id.length = " + id . length + " which is != " + id_width + " required for '" + kind ( ) + ' ' ) ; } final String name = getNameFromCache ( id ) ; if ( name != null ) { incrementCacheHits ( ) ; return Deferred . fromResult ( name ) ; } incrementCacheMiss ( ) ; class GetNameCB implements Callback < String , String > { public String call ( final String name ) { if ( name == null ) { throw new NoSuchUniqueId ( kind ( ) , id ) ; } if ( use_mode ) { switch ( mode ) { case READONLY : addNameToCache ( id , name ) ; break ; case WRITEONLY : break ; default : addNameToCache ( id , name ) ; addIdToCache ( name , id ) ; } } else { addNameToCache ( id , name ) ; addIdToCache ( name , id ) ; } return name ; } } return getNameFromHBase ( id ) . addCallback ( new GetNameCB ( ) ) ; }
Finds the name associated with a given ID .