Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt backport oldest first #4776

Open
wants to merge 12 commits into
base: ja_2030417_backport_subscription_opt_to_6_4
Choose a base branch
from
Prev Previous commit
Next Next commit
Replace system request with a null request
  • Loading branch information
tadgh committed Apr 26, 2023
commit f20206ad29f7f941ca883a4ec342ee5cc54f9f26
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private List<JobInstance> toInstanceList(List<Batch2JobInstanceEntity> theInstan
@Nonnull
public Optional<JobInstance> fetchInstance(String theInstanceId) {
return myTransactionService
.withSystemRequest()
.withRequest(null)
.execute(() -> myJobInstanceRepository.findById(theInstanceId).map(this::toInstance));
}

Expand Down Expand Up @@ -332,7 +332,7 @@ public List<WorkChunk> fetchWorkChunksWithoutData(String theInstanceId, int theP

private void fetchChunks(String theInstanceId, boolean theIncludeData, int thePageSize, int thePageIndex, Consumer<WorkChunk> theConsumer) {
myTransactionService
.withSystemRequest()
.withRequest(null)
.withPropagation(Propagation.REQUIRES_NEW)
.execute(() -> {
List<Batch2WorkChunkEntity> chunks;
Expand All @@ -350,7 +350,7 @@ private void fetchChunks(String theInstanceId, boolean theIncludeData, int thePa
@Override
public List<String> fetchAllChunkIdsForStepWithStatus(String theInstanceId, String theStepId, WorkChunkStatusEnum theStatusEnum) {
return myTransactionService
.withSystemRequest()
.withRequest(null)
.withPropagation(Propagation.REQUIRES_NEW)
.execute(() -> myWorkChunkRepository.fetchAllChunkIdsForStepWithStatus(theInstanceId, theStepId, theStatusEnum));
}
Expand Down Expand Up @@ -422,7 +422,7 @@ public boolean markInstanceAsCompleted(String theInstanceId) {
@Override
public boolean markInstanceAsStatus(String theInstance, StatusEnum theStatusEnum) {
int recordsChanged = myTransactionService
.withSystemRequest()
.withRequest(null)
.execute(()->myJobInstanceRepository.updateInstanceStatus(theInstance, theStatusEnum));
return recordsChanged > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Batch2JobStartResponse startInstance(JobInstanceStartRequest theStartRequ


IJobPersistence.CreateResult instanceAndFirstChunk =
myTransactionService.withSystemRequest().execute(() ->
myTransactionService.withRequest(null).execute(() ->
myJobPersistence.onCreateWithFirstChunk(jobDefinition, theStartRequest.getParameters()));

JobWorkNotification workNotification = JobWorkNotification.firstStepNotification(jobDefinition, instanceAndFirstChunk.jobInstanceId, instanceAndFirstChunk.workChunkId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private void handleWorkChannelMessage(JobWorkNotificationJsonMessage theMessage)
* Run theCallback in TX, rolling back if the supplied Optional is empty.
*/
<T> Optional<T> executeInTxRollbackWhenEmpty(Supplier<Optional<T>> theCallback) {
return myHapiTransactionService.withSystemRequest()
return myHapiTransactionService.withRequest(null)
.execute(theTransactionStatus -> {

// run the processing
Expand Down