# Parallel activities after retry treat as success

**URL:** <https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [October 7, 2024, 9:23pm UTC](https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161 "2024-10-07T21:23:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mramesh](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mramesh](https://community.temporal.io/u/mramesh)\
**Post date:** [October 7, 2024, 9:23pm UTC](https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161/1 "2024-10-07T21:23:53Z")

</div>

Hello,

I have 3 activities to be called in parallel using Async . WF should be failed only if actvity1 and activity2 failed after n retries whereas activity 3 and activity4 should be treated as success after n retries.  
what would be the best way ti implement this solution. Each activity has it own retry policy  
Promise actvity1= Async.function(() → {  
});

Promise actvity2= Async.function(() → {  
});

Promise actvity3= Async.function(() → {  
});

Promise actvity4= Async.function(() → {  
});

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 8, 2024, 1:38pm UTC](https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161/2 "2024-10-08T13:38:23Z")

</div>

```auto
activity1.get();
activity2.get();
try {
    activity3.get();
} catch (ActivityFailure e) {
  // ignore failure
}
try {
    activity4.get();
} catch (ActivityFailure e) {
  // ignore failure
}

```

---

<div class="post-metadata">

**Author:** ![mramesh](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mramesh](https://community.temporal.io/u/mramesh)\
**Post date:** [October 8, 2024, 4:39pm UTC](https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161/3 "2024-10-08T16:39:40Z")

</div>

Thanks @maxim in case if activity 1 or 2 fails before activity 4 or 5 being called, WF throws error and activity 3 or 4 is never called. is there a way to complete these activities

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 9, 2024, 1:34am UTC](https://community.temporal.io/t/parallel-activities-after-retry-treat-as-success/14161/4 "2024-10-09T01:34:15Z")

</div>

```auto
ActivityFailure failure = null;
try {
    activity1.get();
    activity2.get();
} catch(Exception e) {
    failure = e;
}
try {
    activity3.get();
} catch (ActivityFailure e) {
  // ignore failure
}
try {
    activity4.get();
} catch (ActivityFailure e) {
  // ignore failure
}
if (failure != null) {
   throw failure;
}

```
