vt-password: PasswordValidator can be shared across multiple threads

33 views
Skip to first unread message

Otávio Garcia

unread,
Jan 3, 2014, 11:54:31 PM1/3/14
to vt-middle...@googlegroups.com
Can I share a PasswordValidator instance across multiple threds in my webapplication using CDI?

I have a class like this:

public class PasswordStrength {

    @Produces @ApplicationScoped
    public PasswordValidator getValidatorInstance() {
        [...]
    }
}

So CDI will create only one instance per application instance and share across various requests. PasswordValidator can be used as this without concurrency issues?




Daniel Fisher

unread,
Jan 6, 2014, 2:06:16 PM1/6/14
to vt-middle...@googlegroups.com
Yes, you can share a single instance of PasswordValidator across multiple threads as long as all your Rules are thread safe.

--Daniel Fisher

Reply all
Reply to author
Forward
0 new messages