code: public void readOnly() {
      // Set the innermost kvs to the READONLY sentinel.  This will (gradually)
      // prevent future updates.
      Object[] kvs = _kvs;
      while( true ) {             // Spin, until we lock down the innermost table
        CHM chm = chm(kvs);
        Object[] newkvs = chm._newkvs;
        if( newkvs == READONLY ) break;
        if( chm.CAS_newkvs(READONLY) ) break;
        kvs = newkvs;
        assert kvs != null && kvs != READONLY;
      }
      CHM chm = chm(kvs);
      // Do some table-lock, but not it all
      chm.help_copy_impl(NonBlockingHashMap.this,kvs,false);
    }
docs: Atomically make the set immutable.  Future calls to mutate with wildcard
  matching will throw an IllegalStateException.  This basically outlaws put,
  remove and replace, but allows putIfAbsent and putIfMatch.  Existing
  mutator calls in other threads racing with this thread and will either
  throw IllegalStateException or their update will be visible to this
  thread.  This implies that a simple flag cannot make the Set immutable,
  because a late-arriving update in another thread might see immutable flag
  not set yet, then mutate the Set after the {@link #readOnly} call returns.
  This call can be called concurrently (and indeed until the operation
  completes, all calls on the Set from any thread either complete normally
  or end up calling {@link #readOnly} internally).
  
  <p> This call is useful in debugging multi-threaded programs where the
  Set is constructed in parallel, but construction completes after some
  time; and after construction the Set is only read.  Making the Set
  read-only will cause updates arriving after construction is supposedly
  complete to throw an {@link IllegalStateException}.