If you use AvalonMailRepository, especially if you use AvalonSpoolRepository, and you have a lot of active threads, you are likely to see quite a few:
ERROR mailstore: Exception retrieving mail: java.lang.RuntimeException: Exception caught while retrieving an object, cause: java.io.FileNotFoundException: /path/xxx.Repository.FileObjectStore (No such file or directory), so we're deleting it... good riddance!
People have seen, and asked, about this in the past, so I am going to document why this happens:
AvalonSpoolRepository.accept() clones the key set and iterates over it. That method is synchronized, but remove(String key) is not. So one thread starts running in accept, clones the key set, and starts iterating over it. Meanwhile, another thread finishes processing that message and decides to remove it. Since remove is not synchronized, the file is removed from the repository and the live key set, but the key is still present in the cloned key set, and if the accept() method tries to retrieve(String) that message, it will find that it is removed.
We could synchronize remove(String), but it does not appear that there is any point to doing so, and why would we want to hold up removing a message while waiting for another thread to find a message to process?
The same situation occurs in the JDBC repository, and is logged at debug level rather than error level. AvalonMailRepository should also have the logging level changed.