private <U> CompletableFuture<U> supplyInContext(Supplier<U> supplier, String opDescription) {
        return CompletableFuture.supplyAsync(() -> {
            // TODO: explore a more relaxed locking strategy.
            writeLock.lock();
            try {
                return supplier.get();
            } catch (Throwable ex) {
                log.error("Exception in P4Runtime client of {}, executing {}", deviceId, opDescription, ex);
                throw ex;
            } finally {
                writeLock.unlock();
            }
        }, contextExecutor);
    }
private <U> CompletableFuture<U> supplyInContext(Supplier<U> supplier, String opDescription) {
        return CompletableFuture.supplyAsync(() -> {
           
            writeLock.lock();
            try {
                return supplier.get();
            } catch (Throwable ex) {
                log.error("Exception in P4Runtime client of {}, executing {}", deviceId, opDescription, ex);
                throw ex;
            } finally {
                writeLock.unlock();
            }
        }, contextExecutor);
    }
private <u> completablefuture<u> supplyincontext(supplier<u> supplier, string opdescription) { return completablefuture.supplyasync(() -> { writelock.lock(); try { return supplier.get(); } catch (throwable ex) { log.error("exception in p4runtime client of {}, executing {}", deviceid, opdescription, ex); throw ex; } finally { writelock.unlock(); } }, contextexecutor); }