validate threadpool prefixes
This commit is contained in:
parent
238027d303
commit
882eb99f29
|
@ -404,7 +404,7 @@ public abstract class BaseConfig {
|
|||
|
||||
@Bean(name= BatchConstants.JOB_LAUNCHING_TASK_EXECUTOR)
|
||||
public TaskExecutor jobLaunchingTaskExecutor() {
|
||||
return ThreadPoolUtil.newThreadPool(0, 10, "JobLauncher-");
|
||||
return ThreadPoolUtil.newThreadPool(0, 10, "job-launcher-");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ca.uhn.fhir.util;
|
||||
|
||||
import ca.uhn.fhir.jpa.search.reindex.BlockPolicy;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -12,6 +13,8 @@ public final class ThreadPoolUtil {
|
|||
|
||||
@Nonnull
|
||||
public static ThreadPoolTaskExecutor newThreadPool(int theCorePoolSize, int theMaxPoolSize, String theThreadNamePrefix) {
|
||||
Validate.matchesPattern(theThreadNamePrefix, "[a-z\\-]+", "Thread pool prefix name must consist only of lower-case letters and hyphens");
|
||||
Validate.isTrue(theThreadNamePrefix.endsWith("-"), "Thread pool prefix name must end with a hyphen");
|
||||
ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
asyncTaskExecutor.setCorePoolSize(theCorePoolSize);
|
||||
asyncTaskExecutor.setMaxPoolSize(theMaxPoolSize);
|
||||
|
|
|
@ -1503,7 +1503,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
|||
@Test
|
||||
public void testValidateBundleMultithreaded() throws IOException {
|
||||
// setup
|
||||
StructureDefinition sd = loadStructureDefinition(myDefaultValidationSupport, "/r4/multithread/StructureDefinitionPatientV1.json");
|
||||
StructureDefinition sd = loadStructureDefinition(myDefaultValidationSupport, "/r4/concurrent-bundle/StructureDefinitionPatientV1.json");
|
||||
|
||||
myStructureDefinitionMap.put("https://example.com/StructureDefinition/Patient-v1", sd);
|
||||
|
||||
|
@ -1539,7 +1539,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
|||
|
||||
private Bundle buildBundle(int theSize, boolean theValidBundle) throws IOException {
|
||||
BundleBuilder bundleBuilder = new BundleBuilder(ourCtx);
|
||||
Patient p = ourCtx.newJsonParser().parseResource(Patient.class, loadResource("/r4/multithread/patient.json"));
|
||||
Patient p = ourCtx.newJsonParser().parseResource(Patient.class, loadResource("/r4/concurrent-bundle/patient.json"));
|
||||
for (int i = 0; i < theSize; ++i) {
|
||||
bundleBuilder.addTransactionCreateEntry(p);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue