public long add_if( long x, int hash, ConcurrentAutoTable master ) {
      final long[] t = _t;
      final int idx = hash & (t.length-1);
      // Peel loop; try once fast
      long old = t[idx];
      final boolean ok = CAS( t, idx, old, old+x );
      if( ok ) return old;      // Got it
      // Try harder
      int cnt=0;
      while( true ) {
        old = t[idx];
        if( CAS( t, idx, old, old+x ) ) break; // Got it!
        cnt++;
      }
      if( cnt < MAX_SPIN ) return old; // Allowable spin loop count
      if( t.length >= 1024*1024 ) return old; // too big already

      // Too much contention; double array size in an effort to reduce contention
      //long r = _resizers;
      //final int newbytes = (t.length<<1)<<3/*word to bytes*/;
      //while( !_resizerUpdater.compareAndSet(this,r,r+newbytes) )
      //  r = _resizers;
      //r += newbytes;
      if( master._cat != this ) return old; // Already doubled, don't bother
      //if( (r>>17) != 0 ) {      // Already too much allocation attempts?
      //  // We could use a wait with timeout, so we'll wakeup as soon as the new
      //  // table is ready, or after the timeout in any case.  Annoyingly, this
      //  // breaks the non-blocking property - so for now we just briefly sleep.
      //  //synchronized( this ) { wait(8*megs); }         // Timeout - we always wakeup
      //  try { Thread.sleep(r>>17); } catch( InterruptedException e ) { }
      //  if( master._cat != this ) return old;
      //}

      CAT newcat = new CAT(this,t.length*2,0);
      // Take 1 stab at updating the CAT with the new larger size.  If this
      // fails, we assume some other thread already expanded the CAT - so we
      // do not need to retry until it succeeds.
      while( master._cat == this && !master.CAS_cat(this,newcat) ) {/*empty*/}
      return old;
    }
Return the internal counter striping factor.  Useful for diagnosing
performance problems.
jctools-core/src/main/java/org/jctools/maps/ConcurrentAutoTable.java