Skip to content

Commit 80d09f8

Browse files
siri-varmaCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
1 parent 6fde99e commit 80d09f8

File tree

7 files changed

+9
-2
lines changed

7 files changed

+9
-2
lines changed

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookCarActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public Object run(WorkflowActivityContext ctx) {
3333
try {
3434
TimeUnit.SECONDS.sleep(2);
3535
} catch (InterruptedException e) {
36+
Thread.currentThread().interrupt();
3637
throw new RuntimeException(e);
3738
}
3839

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookFlightActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Object run(WorkflowActivityContext ctx) {
3232
try {
3333
TimeUnit.SECONDS.sleep(2);
3434
} catch (InterruptedException e) {
35+
Thread.currentThread().interrupt();
3536
throw new RuntimeException(e);
3637
}
3738

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookHotelActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public Object run(WorkflowActivityContext ctx) {
3131
Thread.sleep(2000);
3232
} catch (InterruptedException e) {
3333
Thread.currentThread().interrupt();
34+
logger.warn("Activity '{}' was interrupted.", ctx.getName(), e);
35+
throw new RuntimeException("Activity was interrupted", e);
3436
}
3537

3638
String result = "Hotel booked successfully";

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookTripWorkflow.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public WorkflowStub create() {
6262

6363
} catch (TaskFailedException e) {
6464
ctx.getLogger().info("******** executing compensation logic ********");
65-
ctx.getLogger().error("Activity failed: {}", e.getMessage());
65+
ctx.getLogger().error("Activity failed", e);
6666

6767
Collections.reverse(compensations);
6868
for (String compensation : compensations) {
@@ -87,7 +87,7 @@ public WorkflowStub create() {
8787
break;
8888
}
8989
} catch (TaskFailedException ex) {
90-
ctx.getLogger().error("Activity failed during compensation: {}", ex.getMessage());
90+
ctx.getLogger().error("Activity failed during compensation", ex);
9191
}
9292
}
9393
ctx.complete("Workflow failed, compensation applied");

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelCarActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Object run(WorkflowActivityContext ctx) {
3232
try {
3333
TimeUnit.SECONDS.sleep(2);
3434
} catch (InterruptedException e) {
35+
Thread.currentThread().interrupt();
3536
throw new RuntimeException(e);
3637
}
3738

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelFlightActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Object run(WorkflowActivityContext ctx) {
3232
try {
3333
TimeUnit.SECONDS.sleep(2);
3434
} catch (InterruptedException e) {
35+
Thread.currentThread().interrupt();
3536
throw new RuntimeException(e);
3637
}
3738

spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelHotelActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Object run(WorkflowActivityContext ctx) {
3232
try {
3333
TimeUnit.SECONDS.sleep(2);
3434
} catch (InterruptedException e) {
35+
Thread.currentThread().interrupt();
3536
throw new RuntimeException(e);
3637
}
3738

0 commit comments

Comments
 (0)