apache/beam · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

NoopLock is a no-op Lock implementation used where locking is unnecessary; it does not support condition variables, so newCondition() unconditionally throws UnsupportedOperationException. Conditions require real monitor/synchronization semantics the no-op lock cannot provide.

Solutions

  1. Stop using Condition with this lock; use other coordination primitives (CountDownLatch, BlockingQueue, CompletableFuture).
  2. Swap NoopLock for ReentrantLock if condition support is genuinely needed.
  3. Remove condition-based waiting if mutual exclusion is known to be unnecessary.

Example fix

// before
Condition c = noopLock.newCondition();
// after
ReentrantLock lock = new ReentrantLock();
Condition c = lock.newCondition();
Defensive patterns

Strategy: type-guard

Validate before calling

if (lock instanceof NoopLock) throw new IllegalStateException("Condition not supported on NoopLock");

Type guard

boolean supportsConditions(Lock l) { return !(l instanceof NoopLock); }

Try / catch

try { lock.newCondition(); } catch (UnsupportedOperationException e) { /* switch to latch/queue */ }

Prevention

When it happens

Trigger: Calling newCondition() on a NoopLock instance, typically obtained where Beam substitutes a lock-free lock.

Common situations: Code written against java.util.concurrent.locks.Lock that assumes full Lock semantics; refactoring code that used ReentrantLock to use NoopLock while still using await/signal.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/a376c8b0d436ef98. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/NoopLock.java:66

  @Override
  public void lockInterruptibly() {}

  @Override
  public boolean tryLock() {
    return true;
  }

  @Override
  public boolean tryLock(long time, TimeUnit unit) {
    return true;
  }

  @Override
  public void unlock() {}

  @Override
  public Condition newCondition() {
    throw new UnsupportedOperationException("Not implemented");
  }
}

View on GitHub (pinned to 12126d8942)