diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-11-06 14:27:53 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-11-07 14:19:47 +0000 |
commit | 97d42f7035ade2c171c349d01cfcd9b61b71dd52 (patch) | |
tree | 1a1b6d7c52545fcf78a0eb94eb12ec6d225c5d58 /vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java | |
parent | ebef5249cb9d282ace976feac8517a7b44add450 (diff) |
fix - when retrieve topology we are using threadPool and the MDC values are not updated
This time for homing-by-vnf-id parallel requests.
Issue-ID: VID-253
Change-Id: Ic0be1470445c6fef0e18f9b9d8f1604df508265b
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java b/vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java index 23127b61a..9fb15f690 100644 --- a/vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java +++ b/vid-app-common/src/main/java/org/onap/vid/utils/Unchecked.java @@ -20,10 +20,11 @@ package org.onap.vid.utils; -import org.onap.vid.exceptions.GenericUncheckedException; - import java.net.URI; import java.net.URISyntaxException; +import java.util.function.Supplier; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.onap.vid.exceptions.GenericUncheckedException; public class Unchecked { private Unchecked() { @@ -39,5 +40,19 @@ public class Unchecked { } } + @FunctionalInterface + public interface UncheckedThrowingSupplier<T> extends Supplier<T> { + + @Override + default T get() { + try { + return getThrows(); + } catch (Exception e) { + return ExceptionUtils.rethrow(e); + } + } + + T getThrows() throws Exception; + } } |