Do not reconfigure ObjectMapper in FutureTransformUtils 51/86051/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Nov 2019 12:45:04 +0000 (13:45 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Nov 2019 20:18:59 +0000 (21:18 +0100)
This is a shared ObjectMapper, which will be reconfigured on first
access -- we can do that upfront and save some cycles from the fast
path.

Change-Id: Ibdf27ff194350b96ee6aadeaa9725d4cfdc6e9db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d2410c0a3da59dfa11f03a74bc01f252db4894a5)

library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/FutureTransformUtils.java

index 7ba31f0b0fb98456b26b1bf6c08b9813baee7abe..984436453e1db6b77e35a802b8724b39708aa5f0 100644 (file)
@@ -20,14 +20,14 @@ import org.opendaylight.ovsdb.lib.operations.Operation;
 import org.opendaylight.ovsdb.lib.operations.OperationResult;
 
 public final class FutureTransformUtils {
-    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
+            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
     private FutureTransformUtils() {
     }
 
     public static ListenableFuture<List<OperationResult>> transformTransactResponse(
-            ListenableFuture<List<JsonNode>> transactResponseFuture, final List<Operation> operations) {
-        OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            final ListenableFuture<List<JsonNode>> transactResponseFuture, final List<Operation> operations) {
         return Futures.transform(transactResponseFuture, jsonNodes -> {
             final List<OperationResult> operationResults = new ArrayList<>();
             for (int index = 0; index < jsonNodes.size(); index++) {