Im working on a small java library and I got a Class named Operation which is a task to process, for now all the tasks are running in a singleThreadExecutor (sequentially).
I made my own Listener and everything to be able to monitor the current operation being processes.
Im storing my observers in a CopyOnWriteArrayList inside my Operation class.
My biggest concern is that i will create a lot of Operation object and i am unlikely to register more than 1-2 observers. I really dont like the idea of creating a CopyOnWriteArrayList for each Operation instance.
I thought about making my CopyOnWriteArrayList static and make a static method to let the observers register to all the operation but i dont know it seems to be a bad design idea overall...
Anyone has a better idea ?