On 01/01/2022 20:05, Rémy Maucherat wrote:
On Sat, Jan 1, 2022 at 8:20 PM Mark Thomas <ma...@apache.org> wrote:

Hi all,

Probably questions for Rémy but any input welcome.

I'm looking at SpotBugs and it has a few warning for this class. My
questions are:

1. Should the methods the modify the database (createXXX, modifiedXXX,
removedXXX) use writeLock rather than readLock?

This is copy/pasted from MemoryUserDatabase. I think this is probably
as intended, this prevents a concurrent read, and the only actual
write operation is persisting to the database.

Thanks for the pointer. That helps. I think a little additional locking is going to be required to keep everything consistent.

2. What sequence of actions between saves are meant to be supported? I'm
thinking about combinations of create/modify/delete?

Any. Hopefully the user is a bit reasonable ;) It should work like the
MemoryUserDatabase, modifications occur locally until the save
operation which updates the database. The test case has scenarios, so
if you find some more that you want to have supported they can be
added there ...

For example, if a user is created:
- createdUsers.put and modifiedUsers.remove
- the if you modify it, it won't do anything more since the user is
already in createdUsers

OK. Thanks. I thought I found a few problematic scenarios but I need to think them through some more. Adding test cases is a good idea.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to