private <T> T lockedSupplier(Supplier<T> supplier) {
        if (lock.isHeldByCurrentThread()) {
            return supplier.get();
        }

        disallowedDuperModeLockAcquisitionRegions
                .assertOutsideCriticalRegions("acquiring duper model lock");

        lock.lock();
        try {
            return supplier.get();
        } finally {
            lock.unlock();
        }
    }
Within the region, trying to accesss the duper model (without already having the lock)
will cause an IllegalStateException to be thrown.
service-monitor/src/main/java/com/yahoo/vespa/service/duper/DuperModelManager.java