I have now tried to downgrade to 2.2.0, and I cannot reproduce the effect 
there (only tried filerepositories on this version).

I also tried using Derby/db on trunk, and saw "just" the delay.

I will try out your patch.

--Søren

On Wednesday 07 September 2005 11:30, Stefano Bagnara wrote:
> > > Can you try downgrading to 2.2.0 and verify wether the
> >
> > issue is there
> >
> > > or not?
> >
> > Will do that today.
> >
> > > Can you try using db/derby to check wether the issue is
> >
> > there or not?
> >
> >
> > Sure.
>
> I'm testing a patch to both JDBC and Avalon repositories.
> It seems working better than before. I'll run my stress-tests and
> eventually commit the code so you can test it, too!
>
> Stefano
>
> ------
>
>
> Index:
> james/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
> ===================================================================
> ---
> james/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
> (revision 233041)
> +++
> james/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
> (working copy)
> @@ -205,6 +205,7 @@
>  //            synchronized (this) {
>  //                notifyAll();
>  //            }
> +            notify();
>              return true;
>          } else {
>              return false;
> Index:
> james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
> ===================================================================
> --- james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
> (revision 233041)
> +++ james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
> (working copy)
> @@ -494,7 +494,7 @@
>       *
>       * @return true if successfully released the lock, false otherwise
>       */
> -    public synchronized boolean unlock(String key) {
> +    public boolean unlock(String key) {
>          if (lock.unlock(key)) {
>              if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
>                  StringBuffer debugBuffer =
> @@ -508,6 +508,7 @@
>                  getLogger().debug(debugBuffer.toString());
>              }
>  //            notifyAll();
> +            notify();
>              return true;
>          } else {
>              return false;
> @@ -521,7 +522,7 @@
>       *
>       * @return true if successfully obtained the lock, false otherwise
>       */
> -    public synchronized boolean lock(String key) {
> +    public boolean lock(String key) {
>          if (lock.lock(key)) {
>              if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
>                  StringBuffer debugBuffer =
> @@ -546,7 +547,17 @@
>       */
>      public void store(MailImpl mc) throws MessagingException {
>          Connection conn = null;
> +        boolean wasLocked = true;
> +        String key = mc.getName();
>          try {
> +            synchronized(this) {
> +                   wasLocked = lock.isLocked(key);
> +
> +                   if (!wasLocked) {
> +                       //If it wasn't locked, we want a lock during the
> store
> +                       lock.lock(key);
> +                   }
> +            }
>              conn = datasource.getConnection();
>
>              //Need to determine whether need to insert this record, or
> update it.
> @@ -775,6 +786,10 @@
>              throw new MessagingException("Exception caught while storing
> mail Container: " + e);
>          } finally {
>              theJDBCUtil.closeJDBCConnection(conn);
> +            if (!wasLocked) {
> +                //If it wasn't locked, we need to now unlock
> +                lock.unlock(key);
> +            }
>          }
>      }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Søren Hilmer, M.Sc.
R&D manager             Phone:  +45 72 30 64 00
TietoEnator IT+ A/S     Fax:    +45 72 30 64 02
Ved Lunden 12           Direct: +45 72 30 64 57
DK-8230 Åbyhøj          Email:  soren.hilmer <at> tietoenator.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to