- // We want a full CAS with setVolatile() memory semantics, as we want to force happen-before
- // for everything, including whatever user code works.
- final boolean wasRunning = SEALED.compareAndSet(this, 0, 1);
- checkState(wasRunning, "Attempted to seal an already-sealed Data Tree.");
+ // We want a full CAS with setVolatile() memory semantics, as we want to force happen-before for everything,
+ // including whatever user code works.
+ if (!SEALED.compareAndSet(this, 0, 1)) {
+ throw new IllegalStateException("Attempted to seal an already-sealed Data Tree.");
+ }