Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is jCaptcha thread safe?

I'm using JCaptcha in a project and needed a behavior that was not directly available. so I looked into the source code to see if I can extend it to obtain what I want and found that the store implementation I use (MapCaptchaStore) uses a HashMap as the store... with no synchronization.

I know JCaptcha does not work in a clustered environment, it is not my case, but how about multiple clients at the same time? Is the store implementation synchronized externally or should I roll my own and make sure it is properly synchronized?

TIA!

like image 921
user90210 Avatar asked Sep 07 '26 17:09

user90210


1 Answers

Judging by the reading source for MapCaptchaStore, this class is NOT thread-safe. I'm not 100% willing to stand behind this answer though, because synchronisation may be happening at a higher level (eg all accesses to a single instance of MapCaptchaStore may be synchronised on another object).

You could use another implementation of CaptchaStore. For example, EhcacheCaptchaStore

like image 126
Steve McLeod Avatar answered Sep 10 '26 08:09

Steve McLeod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!