Is jCaptcha thread safe?

I am using JCaptcha in a project and need behavior that was not directly accessible. so I looked at the source code to find out if I can expand it to get what I want, and found that the storage implementation I use ( MapCaptchaStore ) uses HashMap as the storage ... without synchronization.

I know that JCaptcha does not work in a cluster environment, this is not my case, but what about several clients at the same time? Is the storage implementation synchronized externally or should I use it myself and make sure it is correctly synchronized?

TIA!

+3
source share
3 answers

Judging by the reading source for MapCaptchaStore, this class is NOT thread safe. I am not 100% agree with this, because synchronization can occur at a higher level (for example, all calls to one instance of MapCaptchaStore can be synchronized on another object).

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

+1
source

The main implementation of the hashmap of the captcha repository is not synchronized, which can lead to some strange behavior. Other stores are thread safe; for a simple implementation, use FastHashMapCaptchaStore.

+1
source

, , -, . CAPTCHA, , .

, - .

0
source

Source: https://habr.com/ru/post/1775133/


All Articles