Force the caller to run the bundle task if we are operating with <= 1 pool size
This commit is contained in:
parent
3a7d778591
commit
c2c6e0b440
|
@ -154,7 +154,7 @@ public abstract class BaseTransactionProcessor {
|
||||||
private InMemoryResourceMatcher myInMemoryResourceMatcher;
|
private InMemoryResourceMatcher myInMemoryResourceMatcher;
|
||||||
|
|
||||||
private ThreadPoolTaskExecutor myExecutor ;
|
private ThreadPoolTaskExecutor myExecutor ;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void setDaoConfig(DaoConfig theDaoConfig) {
|
public void setDaoConfig(DaoConfig theDaoConfig) {
|
||||||
myDaoConfig = theDaoConfig;
|
myDaoConfig = theDaoConfig;
|
||||||
|
@ -349,7 +349,12 @@ public abstract class BaseTransactionProcessor {
|
||||||
for (int i=0; i<requestEntriesSize; i++ ) {
|
for (int i=0; i<requestEntriesSize; i++ ) {
|
||||||
nextRequestEntry = requestEntries.get(i);
|
nextRequestEntry = requestEntries.get(i);
|
||||||
BundleTask bundleTask = new BundleTask(completionLatch, theRequestDetails, responseMap, i, nextRequestEntry, theNestedMode);
|
BundleTask bundleTask = new BundleTask(completionLatch, theRequestDetails, responseMap, i, nextRequestEntry, theNestedMode);
|
||||||
myExecutor.submit(bundleTask);
|
//Don't spin up a new thread for nothing if batch size is <=1
|
||||||
|
if (myDaoConfig.getBundleBatchPoolSize() <= 1) {
|
||||||
|
bundleTask.call();
|
||||||
|
} else {
|
||||||
|
myExecutor.submit(bundleTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// waiting for all tasks to be completed
|
// waiting for all tasks to be completed
|
||||||
|
@ -1557,7 +1562,7 @@ public abstract class BaseTransactionProcessor {
|
||||||
public class BundleTask implements Callable<Void> {
|
public class BundleTask implements Callable<Void> {
|
||||||
|
|
||||||
private CountDownLatch myCompletedLatch;
|
private CountDownLatch myCompletedLatch;
|
||||||
private ServletRequestDetails myRequestDetails;
|
private RequestDetails myRequestDetails;
|
||||||
private IBase myNextReqEntry;
|
private IBase myNextReqEntry;
|
||||||
private Map<Integer, Object> myResponseMap;
|
private Map<Integer, Object> myResponseMap;
|
||||||
private int myResponseOrder;
|
private int myResponseOrder;
|
||||||
|
@ -1565,7 +1570,7 @@ public abstract class BaseTransactionProcessor {
|
||||||
|
|
||||||
protected BundleTask(CountDownLatch theCompletedLatch, RequestDetails theRequestDetails, Map<Integer, Object> theResponseMap, int theResponseOrder, IBase theNextReqEntry, boolean theNestedMode) {
|
protected BundleTask(CountDownLatch theCompletedLatch, RequestDetails theRequestDetails, Map<Integer, Object> theResponseMap, int theResponseOrder, IBase theNextReqEntry, boolean theNestedMode) {
|
||||||
this.myCompletedLatch = theCompletedLatch;
|
this.myCompletedLatch = theCompletedLatch;
|
||||||
this.myRequestDetails = (ServletRequestDetails)theRequestDetails;
|
this.myRequestDetails = theRequestDetails;
|
||||||
this.myNextReqEntry = theNextReqEntry;
|
this.myNextReqEntry = theNextReqEntry;
|
||||||
this.myResponseMap = theResponseMap;
|
this.myResponseMap = theResponseMap;
|
||||||
this.myResponseOrder = theResponseOrder;
|
this.myResponseOrder = theResponseOrder;
|
||||||
|
|
|
@ -117,12 +117,16 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(false);
|
myDaoConfig.setAllowInlineMatchUrlReferences(false);
|
||||||
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
||||||
|
myDaoConfig.setBundleBatchPoolSize(new DaoConfig().getBundleBatchPoolSize());
|
||||||
|
myDaoConfig.setBundleBatchMaxPoolSize(new DaoConfig().getBundleBatchMaxPoolSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void beforeDisableResultReuse() {
|
public void beforeDisableResultReuse() {
|
||||||
myInterceptorRegistry.registerInterceptor(myInterceptor);
|
myInterceptorRegistry.registerInterceptor(myInterceptor);
|
||||||
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
|
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
|
||||||
|
myDaoConfig.setBundleBatchPoolSize(1);
|
||||||
|
myDaoConfig.setBundleBatchMaxPoolSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) {
|
private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) {
|
||||||
|
|
Loading…
Reference in New Issue