# Why doesn't java use thread-safe data structure for signal?

**URL:** https://community.temporal.io/t/why-doesnt-java-use-thread-safe-data-structure-for-signal/4829
**Category:** Community Support
**Tags:** java-sdk
**Created:** [May 30, 2022, 3:14am UTC](https://community.temporal.io/t/why-doesnt-java-use-thread-safe-data-structure-for-signal/4829 "2022-05-30T03:14:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![maki\_XIE](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maki_xie/32/2040_2.png) [@maki\_XIE](https://community.temporal.io/u/maki_XIE)
#### Post date: [May 30, 2022, 3:14am UTC](https://community.temporal.io/t/why-doesnt-java-use-thread-safe-data-structure-for-signal/4829/1 "2022-05-30T03:14:38Z")

</div>

> <https://github.com/temporalio/samples-java/blob/main/src/main/java/io/temporal/samples/hello/HelloSignal.java>

Hey, I read the go’s example and java’s example for signals and found go used channels which is safe for goroutines and java used just simple ArrayList which is not safe for multithreaded. I feel confused. Will there be a problem if the collection storing signal data is not thread-safe, probably the consuming and producing of data inside the list are not done at the same time so ArrayList suffice here?

---

<div class="post-metadata">

### Author: ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)
#### Post date: [May 30, 2022, 4:27am UTC](https://community.temporal.io/t/why-doesnt-java-use-thread-safe-data-structure-for-signal/4829/2 "2022-05-30T04:27:57Z")

</div>

> [@Signal method invocation and workflow thread safety](https://community.temporal.io/t/signal-method-invocation-and-workflow-thread-safety/1679):
>
> How do the signal methods get invoked? Based on [the example here](https://github.com/temporalio/samples-java/blob/master/src/main/java/io/temporal/samples/hello/HelloSignal.java) it looks like you don’t have to worry about thread safety. Which thread handles the signals when there is an existing thread running the workflow code?
