src/java/org/apache/cassandra/utils/UUIDGen.java
// Lazily create node hashes, and cache them for later
Lazily create node hashes, and cache them for later
Lazily create node hashes and cache them for later
private long makeNode(InetAddress addr)
    {
        if (nodeCache.containsKey(addr))
            return nodeCache.get(addr);
        byte[] hash = FBUtilities.hash(ByteBuffer.wrap(addr.toString().getBytes()));
        long node = 0;
        for (int i = 0; i < Math.min(6, hash.length); i++)
            node |= (0x00000000000000ff & (long)hash[i]) << (5-i)*8;
        assert (0xff00000000000000L & node) == 0;
        nodeCache.put(addr, node);
        return node;
    }
private long makeNode ( InetAddress addr ) { if ( nodeCache . containsKey ( addr ) ) return nodeCache . get ( addr ) ; byte [ ] hash = FBUtilities . hash ( ByteBuffer . wrap ( addr . toString ( ) . getBytes ( ) ) ) ; long node = 0 ; for ( int i = 0 ; i < Math . min ( 6 , hash . length ) ; i ++ ) node |= ( 0x00000000000000ff & ( long ) hash [ i ] ) << ( 5 - i ) * 8 ; assert ( 0xff00000000000000L & node ) == 0 ; nodeCache . put ( addr , node ) ; return node ; }
Lazily create node hashes, and cache them for later
Lazily create node hashes and cache them for later
// ideally, we'd use the MAC address, but java doesn't expose that.