Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
martinweiler committed Dec 4, 2024
1 parent 1649d49 commit 25f7e0c
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public void configureTimers() {
Map<String, Object> metadata = getProcess().getMetaData();
String slaDueDateExpression = (String) metadata.get(CUSTOM_SLA_DUE_DATE);
if (slaDueDateExpression != null) {
TimerInstance timer = configureSLATimer(slaDueDateExpression, null);
TimerInstance timer = configureSLATimer(slaDueDateExpression);
if (timer != null) {
this.slaTimerId = timer.getId();
this.slaDueDate = new Date(System.currentTimeMillis() + timer.getDelay());
Expand All @@ -560,10 +560,14 @@ public void configureTimers() {
}
String processDuration = (String) metadata.get(Metadata.PROCESS_DURATION);
if (processDuration != null) {
this.cancelTimerId = registerTimer(createDurationTimer(Duration.parse(processDuration).toMillis()), null).getId();
this.cancelTimerId = registerTimer(createDurationTimer(Duration.parse(processDuration).toMillis())).getId();
}
}

public TimerInstance configureSLATimer(String slaDueDateExpression) {
return configureSLATimer(slaDueDateExpression, null);
}

public TimerInstance configureSLATimer(String slaDueDateExpression, String nodeInstanceId) {
// setup SLA if provided
slaDueDateExpression = resolveVariable(slaDueDateExpression).toString();
Expand Down Expand Up @@ -597,6 +601,10 @@ private TimerInstance createDurationTimer(long duration) {
return timerInstance;
}

private TimerInstance registerTimer(TimerInstance timerInstance) {
return registerTimer(timerInstance, null);
}

private TimerInstance registerTimer(TimerInstance timerInstance, String nodeInstanceId) {
ProcessInstanceJobDescription description =
ProcessInstanceJobDescription.newProcessInstanceJobDescriptionBuilder()
Expand Down

0 comments on commit 25f7e0c

Please sign in to comment.