void () { lockToAcquire = switch (LOCK_KIND) { case "dummyLock" -> DUMMY_LOCK; case "reentrantLock" -> reentrantLock; case "readWrite.readLock" -> readWriteLock.readLock(); case "readWrite.writeLock" -> readWriteLock.writeLock(); default -> throw new IllegalStateException("LOCK_KIND: " + LOCK_KIND + " is unrecognized"); }; }