This library is not thread-safe and thus does not need synchronisation. All synchronized blocks and synchronised lists etc. should be removed/replaced.
Since the WebSocket implementation does use threads internally, we still need synchronisation between it and the public API surface. I see a couple of options:
- Make everything
synchronized.
- Introduce an API to hand in a lock from the application that is being used for pretty much everything.
- Get rid of the WebSocket threads and allow this library to be run single-threaded (my preference, mid-term).
- Remove the WebSocket transport. Create a transport interface and let the application create its own WebSocket transport (my preference, long-term).
This library is not thread-safe and thus does not need synchronisation. All
synchronizedblocks and synchronised lists etc. should be removed/replaced.Since the WebSocket implementation does use threads internally, we still need synchronisation between it and the public API surface. I see a couple of options:
synchronized.