CHM( final NonBlockingHashMapLong nbhml, Counter size, final int logsize ) { _nbhml = nbhml; _size = size; _slots= new Counter(); _keys = new long [1<<logsize]; _vals = new Object[1<<logsize]; }
CHM( final NonBlockingHashMapLong nbhml, Counter size, final int logsize ) { _nbhml = nbhml; _size = size; _slots= new Counter(); _keys = new long [1<<logsize]; _vals = new Object[1<<logsize]; }
private final void initialize( final int initial_sz ) { if( initial_sz < 0 ) throw new IllegalArgumentException(); int i; // Convert to next largest power-of-2 for( i=MIN_SIZE_LOG; (1<<i) < initial_sz; i++ ) ; _chm = new CHM(this,new Counter(),i); _val_1 = TOMBSTONE; // Always as-if deleted _last_resize_milli = System.currentTimeMillis(); }
private final void initialize( final int initial_sz ) { if( initial_sz < 0 ) throw new IllegalArgumentException(); int i; // Convert to next largest power-of-2 for( i=MIN_SIZE_LOG; (1<<i) < initial_sz; i++ ) ; _chm = new CHM(this,new Counter(),i); _val_1 = TOMBSTONE; // Always as-if deleted _last_resize_milli = System.currentTimeMillis(); }
/** Get and clear the current count of reprobes. Reprobes happen on key * collisions, and a high reprobe rate may indicate a poor hash function or * weaknesses in the table resizing function. * @return the count of reprobes since the last call to {@link #reprobes} * or since the table was created. */ public long reprobes() { long r = _reprobes.get(); _reprobes = new Counter(); return r; }
/** Get and clear the current count of reprobes. Reprobes happen on key * collisions, and a high reprobe rate may indicate a poor hash function or * weaknesses in the table resizing function. * @return the count of reprobes since the last call to {@link #reprobes} * or since the table was created. */ public long reprobes() { long r = _reprobes.get(); _reprobes = new Counter(); return r; }
/** Removes all of the mappings from this map. */ public void clear() { // Smack a new empty table down CHM newchm = new CHM(this,new Counter(),MIN_SIZE_LOG); while( !CAS_chm(_chm, newchm) ) ; // Spin until the clear works CAS_val_1(_val_1, TOMBSTONE); }
/** Removes all of the mappings from this map. */ public void clear() { // Smack a new empty table down CHM newchm = new CHM(this,new Counter(),MIN_SIZE_LOG); while( !CAS_chm(_chm, newchm) ) ; // Spin until the clear works CAS_val_1(_val_1, TOMBSTONE); }