webcerebrium / java-binance-api

Java Binance API Client
MIT License
73 stars 40 forks source link

ThreadSafe implementation of balances #2

Closed PetteriPertola closed 6 years ago

PetteriPertola commented 6 years ago

Hi,

The current implementation of BinanceApi.balancesMap() is not thread safe as you are using a HashMap. Is it possible to change it to ConcurrentHashMap? Even though my call to getting the balances is single-threaded, the resulting map is used in a multithreaded application.

Using version 1.0.3.

Great job with the client, very intuitive and easy to use.

wcrbrm commented 6 years ago

thanks for a feedback, probably it makes sense. Will be releasing 1.0.6 this week with that in mind

PetteriPertola commented 6 years ago

Sounds great, please notify here when that happens so I'll update to the latest version. Right now I have a workaround by just copying the map to a concurrent map but it's not exactly an efficient way to do it :-)

wcrbrm commented 6 years ago

@PetteriPertola feel free to take release 1.0.6, with this update, it should be already available as maven central dependency: http://repo1.maven.org/maven2/com/webcerebrium/binance-api/

PetteriPertola commented 6 years ago

Thanks a lot.