holunda-io / camunda-bpm-taskpool

Library for pooling user tasks and process related business objects.
https://www.holunda.io/camunda-bpm-taskpool/
Apache License 2.0
68 stars 26 forks source link

Simple View: Duplicate dataEntries storage #747

Closed jangalinski closed 1 year ago

jangalinski commented 1 year ago

Scenario

I noticed that when I use the simple-view and have to manage tasks and dataEntries, the SimpleTaskpoolService also keeps an in mem ConcurrentMap of dataEntries

private val dataEntries = ConcurrentHashMap<String, DataEntry>()

It is my understanding that this map is a complete in memory copy of the map contained in the SimpleDataEntryService.

Current Behaviour

s.a.

Wanted Behaviour

Both services share an in-mem dataEntries map. This not only saves memory consumption but also simplifies testing of scenarios where tasks and dataEntries are used (currently I have to call "on" in two services to have a correct state).

Possible Workarounds

I guess it would be enough to make the ConcurrentHashMap properties "injectable" via constructor, so I can create one instance up front and use this in both services.

zambrovski commented 1 year ago

I don't want to make it too complicated, but rather made the maps to parameters of services which can be passed from outside.