james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oki DZ <ok...@pindad.com>
Subject Message lock
Date Mon, 06 Aug 2001 02:58:48 GMT

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.


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

View raw message