code: private void doRehash(int new_table_size)
                      throws IOException,
                      EOFException,
                      FileManagerException,
                      ClassNotFoundException,
                      HashtableOnDiskException {
          //
          // Acquire the lock to prevent iteration while doubling
          //
          iterationLock.p();
  
          //
          // Step 0:
          // This should be our only exposure = for a short time we
          // will have allocated the new table but not stored its location
          // anywhere.  If we crash here we leak that storage permanently.
          //        
  
          long new_table = 0;
  
          header.setRehashFlag(1);
          new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE);
  
          header.initNewTable(new_table_size, new_table);
          PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size);
          new_htindex = (long[]) longPoolEntry.getArray();
          //new_htindex = new long[new_table_size];                                        
  
          Rehash rehash = new Rehash(this, new_table, new_table_size);
          Thread t = new Thread(rehash);
          t.start();
      }
docs: Double the size of the hash table -
  
  The variable rehashInProgress is set to non-0 on disk to indicate
  that rehashing is in progress. We use rehashInProgress to temporarily
  hold the hash bucket in the new table while chaining the old one in.
  So rehashInProgress is either 0 (rehash done), 1 (rehash in progress),
  or something else (rehash in progress, points to hash bucket in new
  table).
  
  The algorithm is this:
  1. Allocate a new hashtable and set rehashInProgress to 1.
  2. For each entry in the old table (OT), calculate its new
  hash in the new table. If the bucket is not empty, save
  its value in the rehashInProgress pointer. Now place
  the pointer to the entry in the new table.
  
  If the entry has a "next" entry.
  3. Set the bucket pointer in OT to point to it.
  4. Set the "next" pointer in the entry to the saved
  value from 2.
  5. Set rehashInProgress to 1.