Skip to content

Commit

Permalink
Merge pull request #619 from axonivy-market/XIVY-15281/deprecated-ivy…
Browse files Browse the repository at this point in the history
…-async-runner-10

replace `IvyAsyncRunner` with `IvyAsyncExecutor`
  • Loading branch information
ivy-lgi authored Nov 2, 2024
2 parents 25ca61f + 82766b1 commit 44f51a0
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.model.value.SignalCode;
import ch.ivyteam.util.threadcontext.IvyAsyncRunner;
import ch.ivyteam.ivy.request.async.IvyAsyncExecutor;

/**
* Fires a signal to the BPM Engine when the result of an asynchronous REST
* request is available.
*
* <p>
* Async callback methods use the {@link IvyAsyncRunner} to avoid
* Async callback methods use the {@link IvyAsyncExecutor} to avoid
* environment not available exceptions.
* </p>
*
Expand All @@ -25,7 +25,7 @@ public class SignalInvoker implements InvocationCallback<String>
{
private final SignalCode successSignal;
private final SignalCode errorSignal;
private final IvyAsyncRunner asyncRunner;
private final IvyAsyncExecutor asyncExecutor;

public SignalInvoker(String successSignal)
{
Expand All @@ -36,19 +36,19 @@ public SignalInvoker(String successSignal, String errorSignal)
{
this.successSignal = new SignalCode(successSignal);
this.errorSignal = new SignalCode(errorSignal);
this.asyncRunner = new IvyAsyncRunner();
this.asyncExecutor = IvyAsyncExecutor.create();
}

@Override
public void completed(String response)
{
asyncRunner.run(() -> Ivy.wf().signals().send(successSignal, response));
asyncExecutor.run(() -> Ivy.wf().signals().send(successSignal, response));
}

@Override
public void failed(Throwable throwable)
{
asyncRunner.run(() -> Ivy.wf().signals().send(errorSignal, throwable));
asyncExecutor.run(() -> Ivy.wf().signals().send(errorSignal, throwable));
}

}

0 comments on commit 44f51a0

Please sign in to comment.