james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serge Knystautas" <ser...@lokitech.com>
Subject Re: Message lock
Date Mon, 06 Aug 2001 03:55:23 GMT
Oki,

This is an interesting find... the implementation is taken from the
AvalonMailRepository, so it seems it's broken in both places.  I'm kind of
surprised it was working.

I'll go through and clean things up now.

Serge Knystautas
Loki Technologies
http://www.lokitech.com/
----- Original Message -----
From: "Oki DZ" <okidz@pindad.com>
To: <james-dev@jakarta.apache.org>
Sent: Sunday, August 05, 2001 10:58 PM
Subject: Message lock


> Hi,
>
> I notice that JDBCMailRepository has lock() and unlock() methods that
> return void, but the checking for message lock in the spool repository
> doesn't utilize those methods.
>
> public class JDBCSpoolRepository extends JDBCMailRepository
>     implements SpoolRepository {
>
>     public synchronized String accept() {
>         while (true) {
>             try {
>                 //...
>                 while (rsListMessages.next()) {
>                     String message = rsListMessages.getString(1);
>                     if (lock.lock(message)) {
>                       //...
>                     }
> //...
>
> Once I tried to use 5 spool managers to work concurrently using the above
> accept() method, and I noticed that in the logs there were messages on
> duplicating records in the database.
>
> In my implementation of the mail/spool repository classes, I changed the
> lock() and unlock() methods to return boolean, and the above check to
> if(lock(message)). Then I had a light test (I didn't put James on a
> production server), James worked fine. Besides, if I had more than one
> spool manager running but the notifyAll() method (which defined in
> JDBCMailRepository.lock()/unlock()) didn't get executed when the spool
> couldn't get a lock on a message, the spool managers got stuck in the
> JDBCSpoolRepository.wait() method.
>
> As I understand it, when you have a wait() method, you have to have
> notify() or notifyAll() somewhere in your code.
>
> Oki
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>
----------------------------------------------------
This message was brought to you by MailHive.net

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


Mime
View raw message