Source:
<code>protected void performWorkload(BaseSubscriber<Document> baseSubscriber, long i) throws Exception { Flux<Document> obs; boolean readyMyWrite = RandomUtils.nextBoolean(); if (readyMyWrite) { int j = Math.toIntExact(Math.floorMod(i, 3)); switch (j) { case 0: obs = writeDocument() .flatMap(this::readDocument); break; case 1: obs = writeDocument() .flatMap(d -> singlePartitionQuery(d) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my write in a single partition query!")))); break; case 2: obs = writeDocument() .flatMap(d -> xPartitionQuery(generateQuery(d)) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my write in a cross partition query!")))); break; default: assert false; throw new IllegalStateException(); } } else { int j = Math.toIntExact(Math.floorMod(i, 4)); switch (j) { case 0: obs = writeDocument(); break; case 1: obs = readDocument(cache.get(cacheKey())); break; case 2: obs = singlePartitionQuery(cache.get(cacheKey())) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my cached write in a single partition query!"))); break; case 3: obs = xPartitionQuery(generateRandomQuery()) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my cached write in a cross partition query!"))); break; default: assert false; throw new IllegalStateException(); } } concurrencyControlSemaphore.acquire(); logger.debug("concurrencyControlSemaphore: {}", concurrencyControlSemaphore); try { obs.subscribeOn(Schedulers.parallel()).subscribe(baseSubscriber); } catch (Throwable error) { concurrencyControlSemaphore.release(); <START> logger.error("subscription failed due to ", error); <END> } }</code><technical_language>try/catch for subscribe needed. please remove, a failure in case please share stacktrace here</technical_language>

Target:
protected void performWorkload(BaseSubscriber<Document> baseSubscriber, long i) throws Exception { Flux<Document> obs; boolean readyMyWrite = RandomUtils.nextBoolean(); if (readyMyWrite) { int j = Math.toIntExact(Math.floorMod(i, 3)); switch (j) { case 0: obs = writeDocument() .flatMap(this::readDocument); break; case 1: obs = writeDocument() .flatMap(d -> singlePartitionQuery(d) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my write in a single partition query!")))); break; case 2: obs = writeDocument() .flatMap(d -> xPartitionQuery(generateQuery(d)) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my write in a cross partition query!")))); break; default: assert false; throw new IllegalStateException(); } } else { int j = Math.toIntExact(Math.floorMod(i, 4)); switch (j) { case 0: obs = writeDocument(); break; case 1: obs = readDocument(cache.get(cacheKey())); break; case 2: obs = singlePartitionQuery(cache.get(cacheKey())) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my cached write in a single partition query!"))); break; case 3: obs = xPartitionQuery(generateRandomQuery()) .switchIfEmpty(Flux.error(new NotFoundException( "couldn't find my cached write in a cross partition query!"))); break; default: assert false; throw new IllegalStateException(); } } concurrencyControlSemaphore.acquire(); logger.debug("concurrencyControlSemaphore: {}", concurrencyControlSemaphore); obs.subscribeOn(Schedulers.parallel()).subscribe(baseSubscriber); }