CHM( final NonBlockingHashMapLong nbhml, ConcurrentAutoTable size, final int logsize ) { _nbhml = nbhml; _size = size; _slots= new ConcurrentAutoTable(); _keys = new long [1<<logsize]; _vals = new Object[1<<logsize]; }
public ConcurrentAutoTableCounter() { counter = new ConcurrentAutoTable(); }
CHM( ConcurrentAutoTable size ) { _size = size; _slots= new ConcurrentAutoTable(); }
CHM( ConcurrentAutoTable size ) { _size = size; _slots= new ConcurrentAutoTable(); }
/** Create a new empty bit-vector */ public NonBlockingSetInt( ) { _nbsi = new NBSI(63, new ConcurrentAutoTable(), this); // The initial 1-word set }
/** 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 ConcurrentAutoTable(); return r; }
private final void initialize( int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 if( initial_sz > 1024*1024 ) initial_sz = 1024*1024; for( i=MIN_SIZE_LOG; (1<<i) < (initial_sz<<2); i++ ) ; // Double size for K,V pairs, add 1 for CHM and 1 for hashes _kvs = new Object[((1<<i)<<1)+2]; _kvs[0] = new CHM(new ConcurrentAutoTable()); // CHM in slot 0 _kvs[1] = new int[1<<i]; // Matching hash entries _last_resize_milli = System.currentTimeMillis(); } // Version for subclassed readObject calls, to be called after the defaultReadObject
/** Empty the bitvector. */ public void clear ( ) { NBSI cleared = new NBSI(63, new ConcurrentAutoTable(), this); // An empty initial NBSI while( !CAS_nbsi( _nbsi, cleared ) ) // Spin until clear works ; }
private final void initialize( int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 if( initial_sz > 1024*1024 ) initial_sz = 1024*1024; for( i=MIN_SIZE_LOG; (1<<i) < (initial_sz<<2); i++ ) ; // Double size for K,V pairs, add 1 for CHM and 1 for hashes _kvs = new Object[((1<<i)<<1)+2]; _kvs[0] = new CHM(new ConcurrentAutoTable()); // CHM in slot 0 _kvs[1] = new int[1<<i]; // Matching hash entries _last_resize_milli = System.currentTimeMillis(); } // Version for subclassed readObject calls, to be called after the defaultReadObject
private void initialize( final int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 for( i=MIN_SIZE_LOG; (1<<i) < initial_sz; i++ ) {/*empty*/} _chm = new CHM(this,new ConcurrentAutoTable(),i); _val_1 = TOMBSTONE; // Always as-if deleted _last_resize_milli = System.currentTimeMillis(); }
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); // Read nothing final int len = s.readInt(); // Read max element _nbsi = new NBSI(len, new ConcurrentAutoTable(), this); for( int i=0; i<len; i++ ) // Read all bits if( s.readBoolean() ) _nbsi.add(i); }
/** 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 ConcurrentAutoTable(); 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 ConcurrentAutoTable(),MIN_SIZE_LOG); while( !CAS(_chm_offset,_chm,newchm) ) { /*Spin until the clear works*/} CAS(_val_1_offset,_val_1,TOMBSTONE); }
CHM( final NonBlockingHashMapLong nbhml, ConcurrentAutoTable size, final int logsize ) { _nbhml = nbhml; _size = size; _slots= new ConcurrentAutoTable(); _keys = new long [1<<logsize]; _vals = new Object[1<<logsize]; }
CHM( ConcurrentAutoTable size ) { _size = size; _slots= new ConcurrentAutoTable(); }
private void initialize( final int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 for( i=MIN_SIZE_LOG; (1<<i) < initial_sz; i++ ) {/*empty*/} _chm = new CHM(this,new ConcurrentAutoTable(),i); _val_1 = TOMBSTONE; // Always as-if deleted _last_resize_milli = System.currentTimeMillis(); }
private final void initialize( int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 if( initial_sz > 1024*1024 ) initial_sz = 1024*1024; for( i=MIN_SIZE_LOG; (1<<i) < (initial_sz<<2); i++ ) ; // Double size for K,V pairs, add 1 for CHM and 1 for hashes _kvs = new Object[((1<<i)<<1)+2]; _kvs[0] = new CHM(new ConcurrentAutoTable()); // CHM in slot 0 _kvs[1] = new int[1<<i]; // Matching hash entries _last_resize_milli = System.currentTimeMillis(); } // Version for subclassed readObject calls, to be called after the defaultReadObject
/** Empty the bitvector. */ public void clear ( ) { NBSI cleared = new NBSI(63, new ConcurrentAutoTable(), this); // An empty initial NBSI while( !CAS_nbsi( _nbsi, cleared ) ) // Spin until clear works ; }
/** 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 ConcurrentAutoTable(); return r; }
private final void initialize( int initial_sz ) { RangeUtil.checkPositiveOrZero(initial_sz, "initial_sz"); int i; // Convert to next largest power-of-2 if( initial_sz > 1024*1024 ) initial_sz = 1024*1024; for( i=MIN_SIZE_LOG; (1<<i) < (initial_sz<<2); i++ ) ; // Double size for K,V pairs, add 1 for CHM and 1 for hashes _kvs = new Object[((1<<i)<<1)+2]; _kvs[0] = new CHM(new ConcurrentAutoTable()); // CHM in slot 0 _kvs[1] = new int[1<<i]; // Matching hash entries _last_resize_milli = System.currentTimeMillis(); } // Version for subclassed readObject calls, to be called after the defaultReadObject