private static Object checkLookupTable( Name name ) { Object obj; synchronized( LOOKUP_TABLE ) { if( LOOKUP_TABLE.containsKey( name ) == false ) { LOOKUP_TABLE.put( name, name ); return null; } while( LOOKUP_TABLE.containsKey( name )) { try { LOOKUP_TABLE.wait(); } catch( InterruptedException e ) { } } } obj = getCachedAddress( name ); if( obj == null ) { synchronized( LOOKUP_TABLE ) { LOOKUP_TABLE.put( name, name ); } } return obj; } private static void updateLookupTable( Name name ) {
private static Object checkLookupTable( Name name ) { Object obj; synchronized( LOOKUP_TABLE ) { if( LOOKUP_TABLE.containsKey( name ) == false ) { LOOKUP_TABLE.put( name, name ); return null; } while( LOOKUP_TABLE.containsKey( name )) { try { LOOKUP_TABLE.wait(); } catch( InterruptedException e ) { } } } obj = getCachedAddress( name ); if( obj == null ) { synchronized( LOOKUP_TABLE ) { LOOKUP_TABLE.put( name, name ); } } return obj; } private static void updateLookupTable( Name name ) {
private static Object checkLookupTable( Name name ) { Object obj; synchronized( LOOKUP_TABLE ) { if( LOOKUP_TABLE.containsKey( name ) == false ) { LOOKUP_TABLE.put( name, name ); return null; } while( LOOKUP_TABLE.containsKey( name )) { try { LOOKUP_TABLE.wait(); } catch( InterruptedException e ) { } } } obj = getCachedAddress( name ); if( obj == null ) { synchronized( LOOKUP_TABLE ) { LOOKUP_TABLE.put( name, name ); } } return obj; } private static void updateLookupTable( Name name ) {
private static Object checkLookupTable( Name name ) { Object obj; synchronized( LOOKUP_TABLE ) { if( LOOKUP_TABLE.containsKey( name ) == false ) { LOOKUP_TABLE.put( name, name ); return null; } while( LOOKUP_TABLE.containsKey( name )) { try { LOOKUP_TABLE.wait(); } catch( InterruptedException e ) { } } } obj = getCachedAddress( name ); if( obj == null ) { synchronized( LOOKUP_TABLE ) { LOOKUP_TABLE.put( name, name ); } } return obj; } private static void updateLookupTable( Name name ) {
static NbtAddress doNameQuery( Name name, InetAddress svr ) throws UnknownHostException { NbtAddress addr; if( name.hexCode == 0x1d && svr == null ) { svr = CLIENT.baddr; // bit of a hack but saves a lookup } name.srcHashCode = svr != null ? svr.hashCode() : 0; addr = getCachedAddress( name ); if( addr == null ) { /* This is almost exactly like InetAddress.java. See the * comments there for a description of how the LOOKUP_TABLE prevents * redundant queries from going out on the wire. */ if(( addr = (NbtAddress)checkLookupTable( name )) == null ) { try { addr = CLIENT.getByName( name, svr ); } catch( UnknownHostException uhe ) { addr = UNKNOWN_ADDRESS; } finally { cacheAddress( name, addr ); updateLookupTable( name ); } } } if( addr == UNKNOWN_ADDRESS ) { throw new UnknownHostException( name.toString() ); } return addr; }
static NbtAddress doNameQuery( Name name, InetAddress svr ) throws UnknownHostException { NbtAddress addr; if( name.hexCode == 0x1d && svr == null ) { svr = CLIENT.baddr; // bit of a hack but saves a lookup } name.srcHashCode = svr != null ? svr.hashCode() : 0; addr = getCachedAddress( name ); if( addr == null ) { /* This is almost exactly like InetAddress.java. See the * comments there for a description of how the LOOKUP_TABLE prevents * redundant queries from going out on the wire. */ if(( addr = (NbtAddress)checkLookupTable( name )) == null ) { try { addr = CLIENT.getByName( name, svr ); } catch( UnknownHostException uhe ) { addr = UNKNOWN_ADDRESS; } finally { cacheAddress( name, addr ); updateLookupTable( name ); } } } if( addr == UNKNOWN_ADDRESS ) { throw new UnknownHostException( name.toString() ); } return addr; }
static NbtAddress doNameQuery( Name name, InetAddress svr ) throws UnknownHostException { NbtAddress addr; if( name.hexCode == 0x1d && svr == null ) { svr = CLIENT.baddr; // bit of a hack but saves a lookup } name.srcHashCode = svr != null ? svr.hashCode() : 0; addr = getCachedAddress( name ); if( addr == null ) { /* This was copied amost verbatim from InetAddress.java. See the * comments there for a description of how the LOOKUP_TABLE prevents * redundant queries from going out on the wire. */ if(( addr = (NbtAddress)checkLookupTable( name )) == null ) { try { addr = CLIENT.getByName( name, svr ); } catch( UnknownHostException uhe ) { addr = UNKNOWN_ADDRESS; } finally { cacheAddress( name, addr ); updateLookupTable( name ); } } } if( addr == UNKNOWN_ADDRESS ) { throw new UnknownHostException( name.toString() ); } return addr; }
static NbtAddress doNameQuery( Name name, InetAddress svr ) throws UnknownHostException { NbtAddress addr; if( name.hexCode == 0x1d && svr == null ) { svr = CLIENT.baddr; // bit of a hack but saves a lookup } name.srcHashCode = svr != null ? svr.hashCode() : 0; addr = getCachedAddress( name ); if( addr == null ) { /* This is almost exactly like InetAddress.java. See the * comments there for a description of how the LOOKUP_TABLE prevents * redundant queries from going out on the wire. */ if(( addr = (NbtAddress)checkLookupTable( name )) == null ) { try { addr = CLIENT.getByName( name, svr ); } catch( UnknownHostException uhe ) { addr = UNKNOWN_ADDRESS; } finally { cacheAddress( name, addr ); updateLookupTable( name ); } } } if( addr == UNKNOWN_ADDRESS ) { throw new UnknownHostException( name.toString() ); } return addr; }