From f976bddfa3e0c3b2ef2a59d40da71c71b8211222 Mon Sep 17 00:00:00 2001 From: Andreas Pfeil Date: Thu, 29 Aug 2024 15:48:43 +0200 Subject: [PATCH] speedup: use extra executors for validation and deserialization --- .../pit/pitservice/impl/EmbeddedStrictValidatorStrategy.java | 3 ++- .../kit/datamanager/pit/typeregistry/impl/TypeRegistry.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/kit/datamanager/pit/pitservice/impl/EmbeddedStrictValidatorStrategy.java b/src/main/java/edu/kit/datamanager/pit/pitservice/impl/EmbeddedStrictValidatorStrategy.java index d08224c5..afc65d97 100644 --- a/src/main/java/edu/kit/datamanager/pit/pitservice/impl/EmbeddedStrictValidatorStrategy.java +++ b/src/main/java/edu/kit/datamanager/pit/pitservice/impl/EmbeddedStrictValidatorStrategy.java @@ -29,6 +29,7 @@ public class EmbeddedStrictValidatorStrategy implements IValidationStrategy { private static final Logger LOG = LoggerFactory.getLogger(EmbeddedStrictValidatorStrategy.class); + protected static final Executor EXECUTOR = Executors.newWorkStealingPool(); @Autowired public AsyncLoadingCache typeLoader; @@ -65,7 +66,7 @@ public void validate(PIDRecord pidRecord) throws RecordValidationException, Exte String.format("No type found for identifier %s.", profilePID)); } this.strictProfileValidation(pidRecord, profileDefinition); - }); + }, EXECUTOR); } catch (RuntimeException e) { LOG.error("Could not resolve identifier {}.", profilePID); throw new ExternalServiceException( diff --git a/src/main/java/edu/kit/datamanager/pit/typeregistry/impl/TypeRegistry.java b/src/main/java/edu/kit/datamanager/pit/typeregistry/impl/TypeRegistry.java index f43530da..8e552930 100644 --- a/src/main/java/edu/kit/datamanager/pit/typeregistry/impl/TypeRegistry.java +++ b/src/main/java/edu/kit/datamanager/pit/typeregistry/impl/TypeRegistry.java @@ -40,6 +40,7 @@ public class TypeRegistry implements ITypeRegistry { private static final Logger LOG = LoggerFactory.getLogger(TypeRegistry.class); + protected static final Executor EXECUTOR = Executors.newWorkStealingPool(20); @Autowired public AsyncLoadingCache typeCache; @@ -108,7 +109,7 @@ private TypeDefinition constructTypeDefinition(JsonNode registryRepresentation) final String repeatable = semantics.path("repeatable").asText("No"); typeDefinition.setRepeatable(!"No".equalsIgnoreCase(repeatable)); properties.put(name, typeDefinition); - }); + }, EXECUTOR); }) .collect(Collectors.toList());