james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joachim Draeger ...@joachim-draeger.de>
Subject (JDBC)MailRepository and locking
Date Tue, 06 Jun 2006 06:54:15 GMT

Hi!

I understand Lock as following: I can do everything when the message is not 
locked or is locked by myself (my thread).

remove(String key); only removes a message when it is not locked or locked by 
myself.

1. Shouldn't it throw an exception, when it couldn't obtain a lock?

store(Mail mc); locks a message if it was not locked. It unlocks it afterwards, 
if it was not locked before.

2. Shouldn't it test if obtaining lock was successful and if necessary throw an 
exception?

retrieve(String key) isn't using locks at all.

3. Shouldn't it make use of locking to?
   - I shouldn't retrieve a message someone else is going to delete or update
   - I shouldn't delete/update a message that is being retrieved at the same time
   - But: I should be able to retrieve a message another thread is retrieving at
     the same time.
4. do we have to differentiate between locked because of modifying or locked
    because of retrieving?

Lock has a method boolean canI(final Object key);

5. Nobody should make a decision because of result of canI: it could be changed
    at the same moment. It doesn't seem to be used anywhere. Should we remove it?

I don't know whether I'm right or anything should be changed there. Just to 
clarify things and keep in mind for MessageRepository.

Joachim




---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message