> > 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]