Skip to content

Commit

Permalink
speedup: use extra executors for validation and deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Pfeil committed Aug 29, 2024
1 parent 160bfe0 commit f976bdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, TypeDefinition> typeLoader;
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, TypeDefinition> typeCache;
Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit f976bdd

Please sign in to comment.