You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/06/14 06:59:22 UTC

[james-project] branch 3.8.x updated (b967e3640f -> 1a045fabd8)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a change to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git


    from b967e3640f [maven-release-plugin] prepare release james-project-3.8.0
     new 7c1dd88896 [RELEASE] Switch to 3.8.1-SNAPSHOT
     new 6855334242 [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564)
     new e0e6f24bd0 [FIX] Correctly close JPA EntityManager in a couple of places (#1574)
     new 3aee16ab18 [FIX] Update JPA version in demo container (#1576)
     new bb9cebc6c5 [FIX] JPA: avoid leaks in entity manager
     new d53c432022 [FIX] JPA: add DBCP2 to reuse connections
     new 5766ed8510 JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583)
     new 859cd50d7f [PERF] JPA: reuse EntityManager where possible (#1582)
     new 534a784818 Allow passing openjpa and underlying datasource (DBCP2) properties (#1580)
     new fab19c3df5 [FIX] JPA blocking calls should be moved to bounded elastic
     new 2533185267 JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager
     new 666e32e275 JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all available/known servers; fix issue with `ManageSieveServerFactory` not being singleton causing issues
     new ffff162dc0 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
     new 49fc45c593 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
     new e0178ad314 JAMES-3906 Add a missing license
     new 4d360f65a0 JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management
     new a8d36a520f JAMES-3906 Allow SSL reload of a specific server via the port number
     new 341f2570af JAMES-3906 Tests (and fix) for certificate reload
     new 50aff7b189 JAMES-3906 Documentation
     new c283255d68 JAMES-3906 Use an interface dedicated for certificate reload in bindings
     new 1f67caf387 JAMES-3914 Sieve FileIntoAction: support several recipients
     new 437cae047e JAMES-3914 Sieve Vacation: support several recipients
     new e4fe488290 JAMES-3914 Sieve Redirect: support several recipients
     new 8f8af3a1e9 JAMES-3913 Sieve Reject should discard email
     new d5bad56ca5 JAMES-3914 Sieve Reject: support several recipients
     new e8d9fc6760 JAMES-3914 ActionUtils: drop no longer used method
     new 804f369dd6 [RELEASE] Bump to 3.8.1-SNAPSHOT in examples
     new 1a045fabd8 JAMES-3914 Fix SieveIntegrationTest

The 28 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 backends-common/cassandra/pom.xml                  |   2 +-
 backends-common/jpa/pom.xml                        |   7 +-
 backends-common/opensearch/pom.xml                 |   2 +-
 .../james/backends/opensearch/ClientProvider.java  |   1 -
 backends-common/pom.xml                            |   2 +-
 backends-common/pulsar/pom.xml                     |   2 +-
 backends-common/rabbitmq/pom.xml                   |   2 +-
 code-coverage-report/pom.xml                       |   2 +-
 core/pom.xml                                       |   2 +-
 event-bus/api/pom.xml                              |   2 +-
 event-bus/cassandra/pom.xml                        |   2 +-
 event-bus/distributed/pom.xml                      |   2 +-
 event-bus/in-vm/pom.xml                            |   2 +-
 event-bus/pom.xml                                  |   2 +-
 event-sourcing/event-sourcing-core/pom.xml         |   2 +-
 event-sourcing/event-sourcing-pojo/pom.xml         |   2 +-
 event-sourcing/event-store-api/pom.xml             |   2 +-
 event-sourcing/event-store-cassandra/pom.xml       |   2 +-
 event-sourcing/event-store-memory/pom.xml          |   2 +-
 event-sourcing/pom.xml                             |   2 +-
 examples/custom-healthcheck/pom.xml                |   4 +-
 examples/custom-imap/pom.xml                       |   4 +-
 examples/custom-james-assembly/pom.xml             |   4 +-
 examples/custom-listeners/pom.xml                  |   2 +-
 .../listeners/SetCustomFlagOnBigMessages.java      |   1 +
 examples/custom-mailets/pom.xml                    |   2 +-
 examples/custom-smtp-command/pom.xml               |   4 +-
 examples/custom-smtp-hooks/pom.xml                 |   4 +-
 examples/custom-webadmin-route/pom.xml             |   4 +-
 examples/metrics-graphite/pom.xml                  |   4 +-
 examples/pom.xml                                   |   2 +-
 javax-mail-extension/pom.xml                       |   2 +-
 json/pom.xml                                       |   2 +-
 mailbox/api/pom.xml                                |   2 +-
 mailbox/backup/pom.xml                             |   2 +-
 .../james/mailbox/backup/DefaultMailboxBackup.java |  16 +-
 .../mailbox/backup/ZipMailArchiveRestorer.java     |   1 +
 mailbox/cassandra/pom.xml                          |   2 +-
 .../CassandraMailboxSessionMapperFactory.java      |   5 +
 ...CassandraRecomputeCurrentQuotasServiceTest.java |   2 +-
 mailbox/event/json/pom.xml                         |   2 +-
 mailbox/jpa/pom.xml                                |  13 +-
 .../jpa/JPAMailboxSessionMapperFactory.java        |   8 +-
 .../james/mailbox/jpa/mail/JPAMailboxMapper.java   |  20 +-
 .../james/mailbox/jpa/mail/JPAMessageMapper.java   |  38 ++--
 .../james/mailbox/jpa/mail/JPAModSeqProvider.java  |  16 +-
 .../james/mailbox/jpa/mail/JPAUidProvider.java     |  13 +-
 .../model/openjpa/AbstractJPAMailboxMessage.java   |   1 +
 .../mailbox/jpa/openjpa/OpenJPAMessageManager.java |  37 +++-
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java   |  30 ++-
 .../jpa/quota/JPAPerUserMaxQuotaManager.java       |  90 +++++++--
 .../mailbox/jpa/quota/JpaCurrentQuotaManager.java  |  10 +-
 .../main/resources/META-INF/spring/mailbox-jpa.xml |   3 +-
 .../task/JPARecomputeCurrentQuotasServiceTest.java |   2 +-
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java  |   2 +-
 mailbox/lucene/pom.xml                             |   2 +-
 mailbox/memory/pom.xml                             |   2 +-
 .../MemoryRecomputeCurrentQuotasServiceTest.java   |   4 +-
 mailbox/opensearch/pom.xml                         |   2 +-
 .../deleted-messages-vault-cassandra/pom.xml       |   2 +-
 mailbox/plugin/deleted-messages-vault/pom.xml      |   2 +-
 mailbox/plugin/quota-mailing-cassandra/pom.xml     |   2 +-
 mailbox/plugin/quota-mailing-memory/pom.xml        |   2 +-
 mailbox/plugin/quota-mailing/pom.xml               |   2 +-
 mailbox/plugin/quota-search-opensearch/pom.xml     |   2 +-
 mailbox/plugin/quota-search-scanning/pom.xml       |   2 +-
 mailbox/plugin/quota-search/pom.xml                |   2 +-
 mailbox/pom.xml                                    |   2 +-
 mailbox/scanning-search/pom.xml                    |   2 +-
 mailbox/spring/pom.xml                             |   2 +-
 mailbox/store/pom.xml                              |   2 +-
 .../james/mailbox/store/StoreMailboxManager.java   |   4 +-
 .../james/mailbox/store/StoreMessageManager.java   |  10 +-
 .../mailbox/store/SystemMailboxesProviderImpl.java |   3 +-
 .../store/event/MailboxAnnotationListener.java     |   3 +-
 .../james/mailbox/store/mail/AnnotationMapper.java |  27 ++-
 .../james/mailbox/store/mail/MessageMapper.java    |  46 +++--
 .../james/mailbox/store/mail/ModSeqProvider.java   |   7 +-
 .../james/mailbox/store/mail/UidProvider.java      |   7 +-
 .../store/quota/DefaultUserQuotaRootResolver.java  |   6 +-
 .../store/search/ListeningMessageSearchIndex.java  |   6 +-
 .../mailbox/store/user/SubscriptionMapper.java     |  12 +-
 .../store/event/MailboxAnnotationListenerTest.java |   3 +
 mailbox/tika/pom.xml                               |   2 +-
 mailbox/tools/copier/pom.xml                       |   2 +-
 mailbox/tools/indexer/pom.xml                      |   2 +-
 .../mailbox/tools/indexer/ReIndexerImpl.java       |   1 +
 .../mailbox/tools/indexer/ReIndexerPerformer.java  |  18 +-
 mailbox/tools/jpa-migrator/pom.xml                 |   2 +-
 mailbox/tools/quota-recompute/pom.xml              |   2 +-
 .../quota/task/RecomputeCurrentQuotasService.java  |   9 +-
 mailet/ai/pom.xml                                  |   2 +-
 mailet/amqp/pom.xml                                |   2 +-
 mailet/api/pom.xml                                 |   2 +-
 mailet/base/pom.xml                                |   2 +-
 mailet/crypto/pom.xml                              |   2 +-
 mailet/icalendar/pom.xml                           |   2 +-
 mailet/mailetdocs-maven-plugin/pom.xml             |   2 +-
 mailet/pom.xml                                     |   2 +-
 mailet/standard/pom.xml                            |   2 +-
 mailet/test/pom.xml                                |   2 +-
 mdn/pom.xml                                        |   2 +-
 metrics/metrics-api/pom.xml                        |   2 +-
 metrics/metrics-dropwizard/pom.xml                 |   2 +-
 metrics/metrics-logger/pom.xml                     |   2 +-
 metrics/metrics-tests/pom.xml                      |   2 +-
 metrics/pom.xml                                    |   2 +-
 mpt/all/pom.xml                                    |   2 +-
 mpt/app/pom.xml                                    |   2 +-
 mpt/core/pom.xml                                   |   2 +-
 mpt/impl/imap-mailbox/cassandra/pom.xml            |   2 +-
 mpt/impl/imap-mailbox/core/pom.xml                 |   2 +-
 mpt/impl/imap-mailbox/cyrus/pom.xml                |   2 +-
 mpt/impl/imap-mailbox/external-james/pom.xml       |   2 +-
 mpt/impl/imap-mailbox/inmemory/pom.xml             |   2 +-
 mpt/impl/imap-mailbox/jpa/pom.xml                  |   5 +-
 .../mpt/imapmailbox/jpa/host/JPAHostSystem.java    |   2 +-
 mpt/impl/imap-mailbox/lucenesearch/pom.xml         |   2 +-
 mpt/impl/imap-mailbox/opensearch/pom.xml           |   2 +-
 mpt/impl/imap-mailbox/pom.xml                      |   2 +-
 mpt/impl/imap-mailbox/rabbitmq/pom.xml             |   2 +-
 mpt/impl/managesieve/cassandra/pom.xml             |   2 +-
 mpt/impl/managesieve/core/pom.xml                  |   2 +-
 mpt/impl/managesieve/file/pom.xml                  |   2 +-
 mpt/impl/managesieve/pom.xml                       |   2 +-
 mpt/impl/smtp/cassandra-pulsar/pom.xml             |   2 +-
 .../smtp/cassandra-rabbitmq-object-storage/pom.xml |   2 +-
 mpt/impl/smtp/cassandra/pom.xml                    |   2 +-
 mpt/impl/smtp/core/pom.xml                         |   2 +-
 mpt/impl/smtp/pom.xml                              |   2 +-
 mpt/mavenplugin/pom.xml                            |   2 +-
 mpt/pom.xml                                        |   2 +-
 pom.xml                                            |   7 +-
 protocols/api/pom.xml                              |   2 +-
 protocols/imap/pom.xml                             |   2 +-
 protocols/lmtp/pom.xml                             |   2 +-
 protocols/managesieve/pom.xml                      |   2 +-
 protocols/netty/pom.xml                            |   2 +-
 .../AbstractSSLAwareChannelPipelineFactory.java    |  13 +-
 .../apache/james/protocols/netty/NettyServer.java  |   2 +-
 protocols/pom.xml                                  |   2 +-
 protocols/pop3/pom.xml                             |   2 +-
 protocols/smtp/pom.xml                             |   2 +-
 server/apps/cassandra-app/pom.xml                  |   2 +-
 .../apache/james/JamesServerConcreteContract.java  |   2 +-
 server/apps/cli-integration-tests/pom.xml          |   2 +-
 server/apps/cli/pom.xml                            |   2 +-
 server/apps/demo/startup.sh                        |   4 +-
 .../docs/modules/ROOT/pages/operate/webadmin.adoc  |  23 +++
 server/apps/distributed-app/pom.xml                |   2 +-
 server/apps/distributed-pop3-app/pom.xml           |   2 +-
 server/apps/jpa-app/pom.xml                        |   5 +-
 .../jpa-app/sample-configuration/jvm.properties    |   3 +-
 .../apache/james/JamesServerConcreteContract.java  |   2 +-
 server/apps/jpa-smtp-app/pom.xml                   |  15 +-
 .../sample-configuration/jvm.properties            |   3 +-
 server/apps/memory-app/pom.xml                     |   2 +-
 .../org/apache/james/CertificateReloadTest.java    | 218 +++++++++++++++++++++
 .../org/apache/james/MemoryJamesServerTest.java    |   2 +-
 .../src/test/resources/imapserver2.xml}            |  16 ++
 .../src/test/resources/jwt_publickey               |   0
 .../apps/memory-app/src/test/resources/keystore2   | Bin 0 -> 2726 bytes
 .../src/test/resources/smtpserver2.xml}            |  37 +++-
 server/apps/scaling-pulsar-smtp/pom.xml            |   2 +-
 server/apps/spring-app/pom.xml                     |   5 +-
 server/apps/webadmin-cli/pom.xml                   |   2 +-
 server/blob/blob-aes/pom.xml                       |   2 +-
 server/blob/blob-api/pom.xml                       |   2 +-
 server/blob/blob-cassandra/pom.xml                 |   2 +-
 server/blob/blob-common/pom.xml                    |   2 +-
 server/blob/blob-export-api/pom.xml                |   2 +-
 server/blob/blob-export-file/pom.xml               |   2 +-
 server/blob/blob-memory/pom.xml                    |   2 +-
 server/blob/blob-s3/pom.xml                        |   2 +-
 server/blob/blob-storage-strategy/pom.xml          |   2 +-
 server/blob/mail-store/pom.xml                     |   2 +-
 server/blob/pom.xml                                |   2 +-
 server/container/core/pom.xml                      |   2 +-
 server/container/feature-checks/pom.xml            |   2 +-
 .../james/healthcheck/MailReceptionCheck.java      |   3 +-
 server/container/filesystem-api/pom.xml            |   2 +-
 server/container/guice/blob/api/pom.xml            |   2 +-
 .../container/guice/blob/deduplication-gc/pom.xml  |   2 +-
 server/container/guice/blob/export/pom.xml         |   2 +-
 server/container/guice/blob/memory/pom.xml         |   2 +-
 server/container/guice/blob/s3/pom.xml             |   2 +-
 server/container/guice/cassandra/pom.xml           |   2 +-
 server/container/guice/common/pom.xml              |   2 +-
 .../org/apache/james/TemporaryJamesServer.java     |  18 +-
 server/container/guice/configuration/pom.xml       |   2 +-
 server/container/guice/data-cassandra/pom.xml      |   2 +-
 server/container/guice/data-ldap/pom.xml           |   2 +-
 server/container/guice/distributed/pom.xml         |   2 +-
 server/container/guice/jmx/pom.xml                 |   2 +-
 server/container/guice/jpa-common/pom.xml          |   2 +-
 .../james/modules/data/JPAConfiguration.java       |  87 +++++++-
 .../james/modules/data/JPAEntityManagerModule.java |  53 +++--
 server/container/guice/mailbox-jpa/pom.xml         |   2 +-
 .../mailbox-plugin-deleted-messages-vault/pom.xml  |   2 +-
 server/container/guice/mailbox/pom.xml             |   2 +-
 server/container/guice/mailet/pom.xml              |   2 +-
 server/container/guice/mailrepository-blob/pom.xml |   2 +-
 .../guice/mailrepository-cassandra/pom.xml         |   2 +-
 .../container/guice/mailrepository-loaders/pom.xml |   2 +-
 server/container/guice/memory/pom.xml              |   2 +-
 server/container/guice/onami/pom.xml               |   2 +-
 server/container/guice/opensearch/pom.xml          |   2 +-
 server/container/guice/pom.xml                     |   2 +-
 server/container/guice/protocols/imap/pom.xml      |   2 +-
 .../james/modules/protocols/IMAPServerModule.java  |   3 +
 .../james/modules/protocols/ImapGuiceProbe.java    |   7 +-
 server/container/guice/protocols/jmap/pom.xml      |   2 +-
 server/container/guice/protocols/lmtp/pom.xml      |   2 +-
 .../james/modules/protocols/LMTPServerModule.java  |   3 +
 .../container/guice/protocols/managedsieve/pom.xml |   2 +-
 .../modules/protocols/ManageSieveServerModule.java |   5 +
 server/container/guice/protocols/netty/pom.xml     |   2 +-
 server/container/guice/protocols/pop/pom.xml       |   2 +-
 .../james/modules/protocols/POP3ServerModule.java  |   3 +
 server/container/guice/protocols/smtp/pom.xml      |   2 +-
 .../james/modules/protocols/SMTPServerModule.java  |   3 +
 .../james/modules/protocols/SmtpGuiceProbe.java    |   4 +
 .../guice/protocols/webadmin-data/pom.xml          |   2 +-
 .../guice/protocols/webadmin-jmap/pom.xml          |   2 +-
 .../guice/protocols/webadmin-mail-over-web/pom.xml |   2 +-
 .../guice/protocols/webadmin-mailbox/pom.xml       |   2 +-
 .../guice/protocols/webadmin-mailqueue/pom.xml     |   2 +-
 .../protocols/webadmin-mailrepository/pom.xml      |   2 +-
 .../protocols/webadmin-rabbitmq-mailqueue/pom.xml  |   2 +-
 server/container/guice/protocols/webadmin/pom.xml  |   6 +-
 .../james/modules/server/ServerRouteModule.java}   |   9 +-
 .../james/modules/server/WebAdminServerModule.java |   7 +-
 server/container/guice/queue/activemq/pom.xml      |   2 +-
 server/container/guice/queue/memory/pom.xml        |   2 +-
 server/container/guice/queue/pulsar/pom.xml        |   2 +-
 server/container/guice/queue/rabbitmq/pom.xml      |   2 +-
 server/container/guice/sieve-file/pom.xml          |   2 +-
 server/container/guice/sieve-jpa/pom.xml           |   2 +-
 .../testing/custom-mailets-implementation/pom.xml  |   2 +-
 .../container/guice/testing/custom-mailets/pom.xml |   2 +-
 server/container/guice/testing/dependency/pom.xml  |   2 +-
 server/container/guice/testing/pom.xml             |   2 +-
 server/container/guice/utils/pom.xml               |   2 +-
 server/container/lifecycle-api/pom.xml             |   2 +-
 server/container/mailbox-adapter/pom.xml           |   2 +-
 .../adapter/mailbox/ACLUsernameChangeTaskStep.java |   7 +-
 .../mailbox/MailboxUsernameChangeTaskStep.java     |  16 +-
 server/container/mailbox-jmx/pom.xml               |   2 +-
 server/container/spring/pom.xml                    |   2 +-
 server/container/util/pom.xml                      |   2 +-
 server/data/data-api/pom.xml                       |   2 +-
 server/data/data-cassandra/pom.xml                 |   2 +-
 server/data/data-file/pom.xml                      |   2 +-
 server/data/data-jdbc/pom.xml                      |   2 +-
 server/data/data-jmap-cassandra/pom.xml            |   2 +-
 server/data/data-jmap/pom.xml                      |   2 +-
 server/data/data-jpa/pom.xml                       |   2 +-
 .../james/jpa/healthcheck/JPAHealthCheck.java      |  17 +-
 server/data/data-ldap/pom.xml                      |   2 +-
 server/data/data-library/pom.xml                   |   2 +-
 server/data/data-memory/pom.xml                    |   2 +-
 server/dns-service/dnsservice-api/pom.xml          |   2 +-
 server/dns-service/dnsservice-dnsjava/pom.xml      |   2 +-
 server/dns-service/dnsservice-library/pom.xml      |   2 +-
 server/dns-service/dnsservice-test/pom.xml         |   2 +-
 server/mailet/dkim/pom.xml                         |   2 +-
 server/mailet/integration-testing/pom.xml          |   2 +-
 server/mailet/mailetcontainer-api/pom.xml          |   2 +-
 server/mailet/mailetcontainer-impl/pom.xml         |   2 +-
 server/mailet/mailets/pom.xml                      |   2 +-
 .../james/transport/mailets/RandomStoring.java     |   3 +-
 .../transport/mailets/jsieve/ActionUtils.java      |  20 +-
 .../transport/mailets/jsieve/FileIntoAction.java   |  25 +--
 .../transport/mailets/jsieve/RedirectAction.java   |   2 +-
 .../transport/mailets/jsieve/RejectAction.java     |   9 +-
 .../transport/mailets/jsieve/VacationReply.java    |   2 +-
 .../mailets/delivery/SieveIntegrationTest.java     |  92 +++++++++
 .../james/transport/mailets/delivery/reject.script |   2 +-
 server/mailet/mock-smtp-server/pom.xml             |   2 +-
 server/mailet/rate-limiter-redis/pom.xml           |   2 +-
 server/mailet/rate-limiter/pom.xml                 |   2 +-
 .../remote-delivery-integration-testing/pom.xml    |   2 +-
 server/mailrepository/mailrepository-api/pom.xml   |   2 +-
 server/mailrepository/mailrepository-blob/pom.xml  |   2 +-
 .../mailrepository-cassandra/pom.xml               |   2 +-
 .../mailrepository/mailrepository-memory/pom.xml   |   2 +-
 server/pom.xml                                     |   2 +-
 server/protocols/fetchmail/pom.xml                 |   2 +-
 .../jmap-draft-integration-testing-common/pom.xml  |   2 +-
 .../memory-jmap-draft-integration-testing/pom.xml  |   2 +-
 .../jmap-draft-integration-testing/pom.xml         |   2 +-
 .../pom.xml                                        |   2 +-
 server/protocols/jmap-draft/pom.xml                |   2 +-
 .../jmap/draft/send/PostDequeueDecorator.java      |   1 +
 .../james/jmap/mailet/filter/ActionApplier.java    |   1 +
 .../pom.xml                                        |   2 +-
 .../jmap-rfc-8621-integration-tests-common/pom.xml |   2 +-
 .../memory-jmap-rfc-8621-integration-tests/pom.xml |   2 +-
 .../jmap-rfc-8621-integration-tests/pom.xml        |   2 +-
 server/protocols/jmap-rfc-8621/pom.xml             |   2 +-
 server/protocols/jmap/pom.xml                      |   2 +-
 server/protocols/jwt/pom.xml                       |   2 +-
 server/protocols/protocols-imap4/pom.xml           |   2 +-
 server/protocols/protocols-library/pom.xml         |   2 +-
 .../lib/netty/AbstractConfigurableAsyncServer.java |  11 +-
 .../protocols/lib/netty/AbstractServerFactory.java |  10 +-
 .../lib/netty/CertificateReloadable.java}          |  15 +-
 server/protocols/protocols-lmtp/pom.xml            |   2 +-
 server/protocols/protocols-managesieve/pom.xml     |   2 +-
 .../protocols/protocols-pop3-distributed/pom.xml   |   2 +-
 server/protocols/protocols-pop3/pom.xml            |   2 +-
 .../james/pop3server/netty/POP3ServerFactory.java  |  19 ++
 server/protocols/protocols-smtp/pom.xml            |   2 +-
 .../distributed-webadmin-integration-test/pom.xml  |   2 +-
 .../memory-webadmin-integration-test/pom.xml       |   2 +-
 server/protocols/webadmin-integration-test/pom.xml |   2 +-
 .../webadmin-integration-test-common/pom.xml       |   2 +-
 server/protocols/webadmin/pom.xml                  |   3 +-
 .../webadmin/webadmin-cassandra-data/pom.xml       |   2 +-
 .../protocols/webadmin/webadmin-cassandra/pom.xml  |   2 +-
 server/protocols/webadmin/webadmin-core/pom.xml    |   2 +-
 server/protocols/webadmin/webadmin-data/pom.xml    |   2 +-
 .../webadmin/webadmin-dropwizard-metrics/pom.xml   |   2 +-
 .../webadmin/webadmin-http-client/pom.xml          |   2 +-
 server/protocols/webadmin/webadmin-jmap/pom.xml    |   2 +-
 .../webadmin/webadmin-mail-over-web/pom.xml        |   2 +-
 .../webadmin-mailbox-deleted-message-vault/pom.xml |   2 +-
 .../webadmin/vault/routes/RestoreService.java      |   3 +-
 server/protocols/webadmin/webadmin-mailbox/pom.xml |   2 +-
 .../webadmin/service/CreateMissingParentsTask.java |  15 +-
 .../webadmin/service/ExpireMailboxService.java     |   3 +-
 .../webadmin/service/UserMailboxesService.java     |  41 +++-
 .../protocols/webadmin/webadmin-mailqueue/pom.xml  |   2 +-
 .../webadmin/webadmin-mailrepository/pom.xml       |   2 +-
 server/protocols/webadmin/webadmin-pop3/pom.xml    |   2 +-
 .../pom.xml                                        |  31 +--
 .../protocols/webadmin/ProtocolServerRoutes.java   |  91 +++++++++
 .../protocols/webadmin/webadmin-rabbitmq/pom.xml   |   2 +-
 server/queue/queue-activemq/pom.xml                |   2 +-
 server/queue/queue-api/pom.xml                     |   2 +-
 server/queue/queue-jms/pom.xml                     |   2 +-
 server/queue/queue-memory/pom.xml                  |   2 +-
 server/queue/queue-pulsar/pom.xml                  |   2 +-
 server/queue/queue-rabbitmq/pom.xml                |   2 +-
 server/task/task-api/pom.xml                       |   2 +-
 server/task/task-distributed/pom.xml               |   2 +-
 server/task/task-json/pom.xml                      |   2 +-
 server/task/task-memory/pom.xml                    |   2 +-
 server/testing/pom.xml                             |   2 +-
 src/site/markdown/server/manage-webadmin.md        |  23 +++
 src/site/xdoc/server/config-system.xml             |   9 +-
 testing/base/pom.xml                               |   2 +-
 third-party/clamav/pom.xml                         |   2 +-
 third-party/elasticsearch/pom.xml                  |   2 +-
 third-party/linshare/pom.xml                       |   2 +-
 third-party/pom.xml                                |   2 +-
 third-party/rspamd/pom.xml                         |   2 +-
 .../org/apache/james/rspamd/RspamdListener.java    |  10 +-
 .../rspamd/task/GetMailboxMessagesService.java     |   6 +-
 third-party/spamassassin/pom.xml                   |   2 +-
 .../james/spamassassin/SpamAssassinListener.java   |   2 +
 361 files changed, 1485 insertions(+), 597 deletions(-)
 create mode 100644 server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
 copy server/apps/{distributed-app/src/test/resources/imapserver.xml => memory-app/src/test/resources/imapserver2.xml} (76%)
 copy server/apps/{cli-integration-tests => memory-app}/src/test/resources/jwt_publickey (100%)
 create mode 100644 server/apps/memory-app/src/test/resources/keystore2
 copy server/apps/{cassandra-app/src/test/resources/smtpserver.xml => memory-app/src/test/resources/smtpserver2.xml} (78%)
 copy server/container/guice/protocols/{webadmin-data/src/main/java/org/apache/james/modules/server/DLPRoutesModule.java => webadmin/src/main/java/org/apache/james/modules/server/ServerRouteModule.java} (83%)
 copy mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Welcome.test => server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script (97%)
 copy server/{container/util/src/main/java/org/apache/james/util/streams/Iterables.java => protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java} (82%)
 copy server/protocols/webadmin/{webadmin-mail-over-web => webadmin-protocols}/pom.xml (75%)
 create mode 100644 server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java


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


[james-project] 12/28: JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all available/known servers; fix issue with `ManageSieveServerFactory` not being singleton causing issues

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 666e32e275a1c7d80800eb9f48a5c2c0ed2df659
Author: Wojciech Kapcia <wo...@tigase.org>
AuthorDate: Thu May 11 17:35:22 2023 -0400

    JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all available/known servers; fix issue with `ManageSieveServerFactory` not being singleton causing issues
---
 .../james/modules/protocols/IMAPServerModule.java  |  4 +++
 .../james/modules/protocols/LMTPServerModule.java  |  4 +++
 .../modules/protocols/ManageSieveServerModule.java |  4 +++
 .../james/modules/protocols/POP3ServerModule.java  |  4 +++
 .../james/modules/protocols/SMTPServerModule.java  |  4 +++
 .../james/imapserver/webadmin/ImapRoutes.java      | 22 ++++++++++++
 server/protocols/protocols-library/pom.xml         |  4 +++
 .../lib/netty/AbstractConfigurableAsyncServer.java |  9 ++++-
 .../protocols/lib/netty/AbstractServerFactory.java |  2 ++
 .../protocols/lib/netty/CertificateReloadable.java |  6 ++++
 .../lib/webadmin/AbstractServerRoutes.java         | 42 ++++++++++++++++++++++
 .../james/lmtpserver/webadmin/LMTPRoutes.java      | 21 +++++++++++
 .../webadmin/ManageSieveRoutes.java                | 21 +++++++++++
 .../james/pop3server/webadmin/POP3Routes.java      | 21 +++++++++++
 .../james/smtpserver/webadmin/SmtpRoutes.java      | 21 +++++++++++
 15 files changed, 188 insertions(+), 1 deletion(-)

diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
index 082240b01e..0d84991d97 100644
--- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
+++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
@@ -57,6 +57,7 @@ import org.apache.james.imap.processor.SelectProcessor;
 import org.apache.james.imap.processor.base.AbstractProcessor;
 import org.apache.james.imap.processor.base.UnknownRequestProcessor;
 import org.apache.james.imapserver.netty.IMAPServerFactory;
+import org.apache.james.imapserver.webadmin.ImapRoutes;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.metrics.api.GaugeRegistry;
 import org.apache.james.metrics.api.MetricFactory;
@@ -67,6 +68,7 @@ import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
+import org.apache.james.webadmin.Routes;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.ImmutableList;
@@ -99,6 +101,8 @@ public class IMAPServerModule extends AbstractModule {
         bind(MailboxTyper.class).to(DefaultMailboxTyper.class).in(Scopes.SINGLETON);
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ImapRoutes.class);
     }
 
     @Provides
diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
index 60ed8c28fd..168d2f7027 100644
--- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
+++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
@@ -24,12 +24,14 @@ import org.apache.james.RunArguments;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.lmtpserver.netty.LMTPServerFactory;
+import org.apache.james.lmtpserver.webadmin.LMTPRoutes;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
+import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -42,6 +44,8 @@ public class LMTPServerModule extends AbstractModule {
         bind(LMTPServerFactory.class).in(Scopes.SINGLETON);
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(LmtpGuiceProbe.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(LMTPRoutes.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
index 8c983e46da..9ec6101d8e 100644
--- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -25,12 +25,14 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.managesieve.api.commands.CoreCommands;
 import org.apache.james.managesieve.core.CoreProcessor;
 import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
+import org.apache.james.managesieveserver.webadmin.ManageSieveRoutes;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
+import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.multibindings.Multibinder;
@@ -43,6 +45,8 @@ public class ManageSieveServerModule extends AbstractModule {
         install(new SieveModule());
         bind(CoreCommands.class).to(CoreProcessor.class);
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ManageSieveRoutes.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
index bc00a306da..e22859ff34 100644
--- a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
+++ b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
@@ -26,11 +26,13 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.pop3server.mailbox.DefaultMailboxAdapterFactory;
 import org.apache.james.pop3server.mailbox.MailboxAdapterFactory;
 import org.apache.james.pop3server.netty.POP3ServerFactory;
+import org.apache.james.pop3server.webadmin.POP3Routes;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
+import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -46,6 +48,8 @@ public class POP3ServerModule extends AbstractModule {
         bind(MailboxAdapterFactory.class).to(DefaultMailboxAdapterFactory.class);
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(Pop3GuiceProbe.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(POP3Routes.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
index 22b541da5d..8ba9378900 100644
--- a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
@@ -26,10 +26,12 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.smtpserver.SendMailHandler;
 import org.apache.james.smtpserver.netty.SMTPServerFactory;
+import org.apache.james.smtpserver.webadmin.SmtpRoutes;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
+import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -43,6 +45,8 @@ public class SMTPServerModule extends AbstractModule {
         bind(SMTPServerFactory.class).in(Scopes.SINGLETON);
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SmtpGuiceProbe.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(SmtpRoutes.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
new file mode 100644
index 0000000000..843106583c
--- /dev/null
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
@@ -0,0 +1,22 @@
+package org.apache.james.imapserver.webadmin;
+
+import javax.inject.Inject;
+
+import org.apache.james.imapserver.netty.IMAPServerFactory;
+import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+
+public class ImapRoutes
+        extends AbstractServerRoutes {
+
+    public static final String BASE_PATH = "/imap";
+
+    @Inject
+    public ImapRoutes(IMAPServerFactory imapServerFactory) {
+        this.serverFactory = imapServerFactory;
+    }
+
+    @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+}
\ No newline at end of file
diff --git a/server/protocols/protocols-library/pom.xml b/server/protocols/protocols-library/pom.xml
index ffda3f0739..c527fe454d 100644
--- a/server/protocols/protocols-library/pom.xml
+++ b/server/protocols/protocols-library/pom.xml
@@ -52,6 +52,10 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>metrics-api</artifactId>
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 76e8152a6b..b6ded174ed 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -61,7 +61,10 @@ import io.netty.util.concurrent.EventExecutorGroup;
 /**
  * Abstract base class for Servers for all James Servers
  */
-public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServer implements Configurable, ServerMBean {
+public abstract class AbstractConfigurableAsyncServer
+        extends AbstractAsyncServer
+        implements CertificateReloadable, Configurable, ServerMBean {
+
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractConfigurableAsyncServer.class);
 
     /** The default value for the connection backlog. */
@@ -360,6 +363,10 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
         }
     }
 
+    public void reloadSSLCertificate() throws Exception {
+        buildSSLContext();
+    }
+
     /**
      * Return the default port which will get used for this server if non is
      * specify in the configuration
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
index bf672d5efa..1a9d3d202f 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
+import javax.inject.Singleton;
 
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.tree.ImmutableNode;
@@ -31,6 +32,7 @@ import org.apache.james.lifecycle.api.Configurable;
 /**
  * Abstract base class for Factories that need to create {@link AbstractConfigurableAsyncServer}'s via configuration files
  */
+@Singleton
 public abstract class AbstractServerFactory implements Configurable {
 
     private List<AbstractConfigurableAsyncServer> servers;
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
new file mode 100644
index 0000000000..7ac6f2a44b
--- /dev/null
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
@@ -0,0 +1,6 @@
+package org.apache.james.protocols.lib.netty;
+
+public interface CertificateReloadable {
+
+    void reloadSSLCertificate() throws Exception;
+}
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java
new file mode 100644
index 0000000000..baaa2d4606
--- /dev/null
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java
@@ -0,0 +1,42 @@
+package org.apache.james.protocols.lib.webadmin;
+
+import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.utils.ErrorResponder;
+import org.apache.james.webadmin.utils.Responses;
+import org.eclipse.jetty.http.HttpStatus;
+
+import com.google.common.base.Preconditions;
+
+import spark.Service;
+
+public abstract class AbstractServerRoutes
+        implements Routes {
+
+    protected AbstractServerFactory serverFactory;
+
+    @Override
+    public void define(Service service) {
+        service.post(getBasePath(), (request, response) -> {
+            Preconditions.checkArgument(request.queryParams().contains("reload-certificate"),
+                    "'reload-certificate' query parameter shall be specified");
+
+            if (serverFactory.getServers() == null
+                    || serverFactory.getServers().isEmpty()
+                    || serverFactory.getServers().stream().noneMatch(AbstractConfigurableAsyncServer::isEnabled)) {
+                return ErrorResponder.builder()
+                        .statusCode(HttpStatus.BAD_REQUEST_400)
+                        .type(ErrorResponder.ErrorType.NOT_FOUND)
+                        .message("No servers configured, nothing to reload")
+                        .haltError();
+            }
+
+            for (AbstractConfigurableAsyncServer server : serverFactory.getServers()) {
+                server.reloadSSLCertificate();
+            }
+
+            return Responses.returnNoContent(response);
+        });
+    }
+}
\ No newline at end of file
diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java
new file mode 100644
index 0000000000..ac949aad95
--- /dev/null
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java
@@ -0,0 +1,21 @@
+package org.apache.james.lmtpserver.webadmin;
+
+import javax.inject.Inject;
+
+import org.apache.james.lmtpserver.netty.LMTPServerFactory;
+import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+
+public class LMTPRoutes extends AbstractServerRoutes {
+
+    public static final String BASE_PATH = "/lmtp";
+
+    @Inject
+    public LMTPRoutes(LMTPServerFactory lmtpServerFactory) {
+        this.serverFactory = lmtpServerFactory;
+    }
+
+    @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+}
\ No newline at end of file
diff --git a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java
new file mode 100644
index 0000000000..6aa01b7b27
--- /dev/null
+++ b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java
@@ -0,0 +1,21 @@
+package org.apache.james.managesieveserver.webadmin;
+
+import javax.inject.Inject;
+
+import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
+import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+
+public class ManageSieveRoutes extends AbstractServerRoutes {
+
+    public static final String BASE_PATH = "/sieve";
+
+    @Inject
+    public ManageSieveRoutes(ManageSieveServerFactory manageSieveServerFactory) {
+        this.serverFactory = manageSieveServerFactory;
+    }
+
+    @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+}
\ No newline at end of file
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java
new file mode 100644
index 0000000000..7e41923ea4
--- /dev/null
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java
@@ -0,0 +1,21 @@
+package org.apache.james.pop3server.webadmin;
+
+import javax.inject.Inject;
+
+import org.apache.james.pop3server.netty.POP3ServerFactory;
+import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+
+public class POP3Routes extends AbstractServerRoutes {
+
+    public static final String BASE_PATH = "/pop3";
+
+    @Inject
+    public POP3Routes(POP3ServerFactory pop3ServerFactory) {
+        this.serverFactory = pop3ServerFactory;
+    }
+
+    @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+}
\ No newline at end of file
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java
new file mode 100644
index 0000000000..79d409cc86
--- /dev/null
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java
@@ -0,0 +1,21 @@
+package org.apache.james.smtpserver.webadmin;
+
+import javax.inject.Inject;
+
+import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+import org.apache.james.smtpserver.netty.SMTPServerFactory;
+
+public class SmtpRoutes extends AbstractServerRoutes {
+
+    public static final String BASE_PATH = "/smtp";
+
+    @Inject
+    public SmtpRoutes(SMTPServerFactory imapServerFactory) {
+        this.serverFactory = imapServerFactory;
+    }
+
+    @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+}
\ No newline at end of file


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


[james-project] 14/28: JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 49fc45c5934bf797b53556ff41b5a8c7729f5747
Author: Wojciech Kapcia <wo...@tigase.org>
AuthorDate: Thu May 11 19:15:24 2023 -0400

    JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
---
 .../org/apache/james/protocols/lib/netty/AbstractServerFactory.java     | 2 --
 1 file changed, 2 deletions(-)

diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
index 1a9d3d202f..bf672d5efa 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
@@ -23,7 +23,6 @@ import java.util.List;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
-import javax.inject.Singleton;
 
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.tree.ImmutableNode;
@@ -32,7 +31,6 @@ import org.apache.james.lifecycle.api.Configurable;
 /**
  * Abstract base class for Factories that need to create {@link AbstractConfigurableAsyncServer}'s via configuration files
  */
-@Singleton
 public abstract class AbstractServerFactory implements Configurable {
 
     private List<AbstractConfigurableAsyncServer> servers;


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


[james-project] 06/28: [FIX] JPA: add DBCP2 to reuse connections

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit d53c43202232d2716a079a54686ea0255d853b27
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 5 13:24:48 2023 +0700

    [FIX] JPA: add DBCP2 to reuse connections
---
 backends-common/jpa/pom.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/backends-common/jpa/pom.xml b/backends-common/jpa/pom.xml
index ef0681f24f..b55b1a6f80 100644
--- a/backends-common/jpa/pom.xml
+++ b/backends-common/jpa/pom.xml
@@ -38,6 +38,11 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-dbcp2</artifactId>
+            <version>2.9.0</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derby</artifactId>


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


[james-project] 23/28: JAMES-3914 Sieve Redirect: support several recipients

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e4fe48829088789b6cfe852d2e533b2778302ef7
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 16:00:24 2023 +0700

    JAMES-3914 Sieve Redirect: support several recipients
---
 .../mailets/delivery/SieveIntegrationTest.java       | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 2b7bd165ae..8ea6611774 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -463,6 +463,26 @@ class SieveIntegrationTest {
             .containsExactly(expectedSentMail);
     }
 
+    @Test
+    void redirectShouldWorkWhenSeveralRecipients() throws Exception {
+        prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script");
+        when(usersRepository.getUsername(new MailAddress("other@domain.tld"))).thenReturn(Username.of("other@domain.tld"));
+        when(resourceLocator.get(new MailAddress("other@domain.tld"))).thenThrow(new ScriptNotFoundException());
+
+        FakeMail mail = createMail();
+        mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
+        testee.service(mail);
+
+        assertThat(mail.getRecipients()).containsOnly(new MailAddress("other@domain.tld"));
+        FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
+            .sender("sender@any.com")
+            .recipient(new MailAddress("redirect@apache.org"))
+            .fromMailet()
+            .build();
+        assertThat(fakeMailContext.getSentMails())
+            .containsExactly(expectedSentMail);
+    }
+
     @Test
     void addressCcAllShouldNotMatchOtherHeaders() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script");


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


[james-project] 01/28: [RELEASE] Switch to 3.8.1-SNAPSHOT

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 7c1dd8889600656df9ad50984716cdafe6745d69
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Jun 13 16:19:01 2023 +0700

    [RELEASE] Switch to 3.8.1-SNAPSHOT
---
 backends-common/cassandra/pom.xml                                       | 2 +-
 backends-common/jpa/pom.xml                                             | 2 +-
 backends-common/opensearch/pom.xml                                      | 2 +-
 backends-common/pom.xml                                                 | 2 +-
 backends-common/pulsar/pom.xml                                          | 2 +-
 backends-common/rabbitmq/pom.xml                                        | 2 +-
 code-coverage-report/pom.xml                                            | 2 +-
 core/pom.xml                                                            | 2 +-
 event-bus/api/pom.xml                                                   | 2 +-
 event-bus/cassandra/pom.xml                                             | 2 +-
 event-bus/distributed/pom.xml                                           | 2 +-
 event-bus/in-vm/pom.xml                                                 | 2 +-
 event-bus/pom.xml                                                       | 2 +-
 event-sourcing/event-sourcing-core/pom.xml                              | 2 +-
 event-sourcing/event-sourcing-pojo/pom.xml                              | 2 +-
 event-sourcing/event-store-api/pom.xml                                  | 2 +-
 event-sourcing/event-store-cassandra/pom.xml                            | 2 +-
 event-sourcing/event-store-memory/pom.xml                               | 2 +-
 event-sourcing/pom.xml                                                  | 2 +-
 javax-mail-extension/pom.xml                                            | 2 +-
 json/pom.xml                                                            | 2 +-
 mailbox/api/pom.xml                                                     | 2 +-
 mailbox/backup/pom.xml                                                  | 2 +-
 mailbox/cassandra/pom.xml                                               | 2 +-
 mailbox/event/json/pom.xml                                              | 2 +-
 mailbox/jpa/pom.xml                                                     | 2 +-
 mailbox/lucene/pom.xml                                                  | 2 +-
 mailbox/memory/pom.xml                                                  | 2 +-
 mailbox/opensearch/pom.xml                                              | 2 +-
 mailbox/plugin/deleted-messages-vault-cassandra/pom.xml                 | 2 +-
 mailbox/plugin/deleted-messages-vault/pom.xml                           | 2 +-
 mailbox/plugin/quota-mailing-cassandra/pom.xml                          | 2 +-
 mailbox/plugin/quota-mailing-memory/pom.xml                             | 2 +-
 mailbox/plugin/quota-mailing/pom.xml                                    | 2 +-
 mailbox/plugin/quota-search-opensearch/pom.xml                          | 2 +-
 mailbox/plugin/quota-search-scanning/pom.xml                            | 2 +-
 mailbox/plugin/quota-search/pom.xml                                     | 2 +-
 mailbox/pom.xml                                                         | 2 +-
 mailbox/scanning-search/pom.xml                                         | 2 +-
 mailbox/spring/pom.xml                                                  | 2 +-
 mailbox/store/pom.xml                                                   | 2 +-
 mailbox/tika/pom.xml                                                    | 2 +-
 mailbox/tools/copier/pom.xml                                            | 2 +-
 mailbox/tools/indexer/pom.xml                                           | 2 +-
 mailbox/tools/jpa-migrator/pom.xml                                      | 2 +-
 mailbox/tools/quota-recompute/pom.xml                                   | 2 +-
 mailet/ai/pom.xml                                                       | 2 +-
 mailet/amqp/pom.xml                                                     | 2 +-
 mailet/api/pom.xml                                                      | 2 +-
 mailet/base/pom.xml                                                     | 2 +-
 mailet/crypto/pom.xml                                                   | 2 +-
 mailet/icalendar/pom.xml                                                | 2 +-
 mailet/mailetdocs-maven-plugin/pom.xml                                  | 2 +-
 mailet/pom.xml                                                          | 2 +-
 mailet/standard/pom.xml                                                 | 2 +-
 mailet/test/pom.xml                                                     | 2 +-
 mdn/pom.xml                                                             | 2 +-
 metrics/metrics-api/pom.xml                                             | 2 +-
 metrics/metrics-dropwizard/pom.xml                                      | 2 +-
 metrics/metrics-logger/pom.xml                                          | 2 +-
 metrics/metrics-tests/pom.xml                                           | 2 +-
 metrics/pom.xml                                                         | 2 +-
 mpt/all/pom.xml                                                         | 2 +-
 mpt/app/pom.xml                                                         | 2 +-
 mpt/core/pom.xml                                                        | 2 +-
 mpt/impl/imap-mailbox/cassandra/pom.xml                                 | 2 +-
 mpt/impl/imap-mailbox/core/pom.xml                                      | 2 +-
 mpt/impl/imap-mailbox/cyrus/pom.xml                                     | 2 +-
 mpt/impl/imap-mailbox/external-james/pom.xml                            | 2 +-
 mpt/impl/imap-mailbox/inmemory/pom.xml                                  | 2 +-
 mpt/impl/imap-mailbox/jpa/pom.xml                                       | 2 +-
 mpt/impl/imap-mailbox/lucenesearch/pom.xml                              | 2 +-
 mpt/impl/imap-mailbox/opensearch/pom.xml                                | 2 +-
 mpt/impl/imap-mailbox/pom.xml                                           | 2 +-
 mpt/impl/imap-mailbox/rabbitmq/pom.xml                                  | 2 +-
 mpt/impl/managesieve/cassandra/pom.xml                                  | 2 +-
 mpt/impl/managesieve/core/pom.xml                                       | 2 +-
 mpt/impl/managesieve/file/pom.xml                                       | 2 +-
 mpt/impl/managesieve/pom.xml                                            | 2 +-
 mpt/impl/smtp/cassandra-pulsar/pom.xml                                  | 2 +-
 mpt/impl/smtp/cassandra-rabbitmq-object-storage/pom.xml                 | 2 +-
 mpt/impl/smtp/cassandra/pom.xml                                         | 2 +-
 mpt/impl/smtp/core/pom.xml                                              | 2 +-
 mpt/impl/smtp/pom.xml                                                   | 2 +-
 mpt/mavenplugin/pom.xml                                                 | 2 +-
 mpt/pom.xml                                                             | 2 +-
 pom.xml                                                                 | 2 +-
 protocols/api/pom.xml                                                   | 2 +-
 protocols/imap/pom.xml                                                  | 2 +-
 protocols/lmtp/pom.xml                                                  | 2 +-
 protocols/managesieve/pom.xml                                           | 2 +-
 protocols/netty/pom.xml                                                 | 2 +-
 protocols/pom.xml                                                       | 2 +-
 protocols/pop3/pom.xml                                                  | 2 +-
 protocols/smtp/pom.xml                                                  | 2 +-
 server/apps/cassandra-app/pom.xml                                       | 2 +-
 server/apps/cli-integration-tests/pom.xml                               | 2 +-
 server/apps/cli/pom.xml                                                 | 2 +-
 server/apps/distributed-app/pom.xml                                     | 2 +-
 server/apps/distributed-pop3-app/pom.xml                                | 2 +-
 server/apps/jpa-app/pom.xml                                             | 2 +-
 server/apps/jpa-smtp-app/pom.xml                                        | 2 +-
 server/apps/memory-app/pom.xml                                          | 2 +-
 server/apps/scaling-pulsar-smtp/pom.xml                                 | 2 +-
 server/apps/spring-app/pom.xml                                          | 2 +-
 server/apps/webadmin-cli/pom.xml                                        | 2 +-
 server/blob/blob-aes/pom.xml                                            | 2 +-
 server/blob/blob-api/pom.xml                                            | 2 +-
 server/blob/blob-cassandra/pom.xml                                      | 2 +-
 server/blob/blob-common/pom.xml                                         | 2 +-
 server/blob/blob-export-api/pom.xml                                     | 2 +-
 server/blob/blob-export-file/pom.xml                                    | 2 +-
 server/blob/blob-memory/pom.xml                                         | 2 +-
 server/blob/blob-s3/pom.xml                                             | 2 +-
 server/blob/blob-storage-strategy/pom.xml                               | 2 +-
 server/blob/mail-store/pom.xml                                          | 2 +-
 server/blob/pom.xml                                                     | 2 +-
 server/container/core/pom.xml                                           | 2 +-
 server/container/feature-checks/pom.xml                                 | 2 +-
 server/container/filesystem-api/pom.xml                                 | 2 +-
 server/container/guice/blob/api/pom.xml                                 | 2 +-
 server/container/guice/blob/deduplication-gc/pom.xml                    | 2 +-
 server/container/guice/blob/export/pom.xml                              | 2 +-
 server/container/guice/blob/memory/pom.xml                              | 2 +-
 server/container/guice/blob/s3/pom.xml                                  | 2 +-
 server/container/guice/cassandra/pom.xml                                | 2 +-
 server/container/guice/common/pom.xml                                   | 2 +-
 server/container/guice/configuration/pom.xml                            | 2 +-
 server/container/guice/data-cassandra/pom.xml                           | 2 +-
 server/container/guice/data-ldap/pom.xml                                | 2 +-
 server/container/guice/distributed/pom.xml                              | 2 +-
 server/container/guice/jmx/pom.xml                                      | 2 +-
 server/container/guice/jpa-common/pom.xml                               | 2 +-
 server/container/guice/mailbox-jpa/pom.xml                              | 2 +-
 server/container/guice/mailbox-plugin-deleted-messages-vault/pom.xml    | 2 +-
 server/container/guice/mailbox/pom.xml                                  | 2 +-
 server/container/guice/mailet/pom.xml                                   | 2 +-
 server/container/guice/mailrepository-blob/pom.xml                      | 2 +-
 server/container/guice/mailrepository-cassandra/pom.xml                 | 2 +-
 server/container/guice/mailrepository-loaders/pom.xml                   | 2 +-
 server/container/guice/memory/pom.xml                                   | 2 +-
 server/container/guice/onami/pom.xml                                    | 2 +-
 server/container/guice/opensearch/pom.xml                               | 2 +-
 server/container/guice/pom.xml                                          | 2 +-
 server/container/guice/protocols/imap/pom.xml                           | 2 +-
 server/container/guice/protocols/jmap/pom.xml                           | 2 +-
 server/container/guice/protocols/lmtp/pom.xml                           | 2 +-
 server/container/guice/protocols/managedsieve/pom.xml                   | 2 +-
 server/container/guice/protocols/netty/pom.xml                          | 2 +-
 server/container/guice/protocols/pop/pom.xml                            | 2 +-
 server/container/guice/protocols/smtp/pom.xml                           | 2 +-
 server/container/guice/protocols/webadmin-data/pom.xml                  | 2 +-
 server/container/guice/protocols/webadmin-jmap/pom.xml                  | 2 +-
 server/container/guice/protocols/webadmin-mail-over-web/pom.xml         | 2 +-
 server/container/guice/protocols/webadmin-mailbox/pom.xml               | 2 +-
 server/container/guice/protocols/webadmin-mailqueue/pom.xml             | 2 +-
 server/container/guice/protocols/webadmin-mailrepository/pom.xml        | 2 +-
 server/container/guice/protocols/webadmin-rabbitmq-mailqueue/pom.xml    | 2 +-
 server/container/guice/protocols/webadmin/pom.xml                       | 2 +-
 server/container/guice/queue/activemq/pom.xml                           | 2 +-
 server/container/guice/queue/memory/pom.xml                             | 2 +-
 server/container/guice/queue/pulsar/pom.xml                             | 2 +-
 server/container/guice/queue/rabbitmq/pom.xml                           | 2 +-
 server/container/guice/sieve-file/pom.xml                               | 2 +-
 server/container/guice/sieve-jpa/pom.xml                                | 2 +-
 server/container/guice/testing/custom-mailets-implementation/pom.xml    | 2 +-
 server/container/guice/testing/custom-mailets/pom.xml                   | 2 +-
 server/container/guice/testing/dependency/pom.xml                       | 2 +-
 server/container/guice/testing/pom.xml                                  | 2 +-
 server/container/guice/utils/pom.xml                                    | 2 +-
 server/container/lifecycle-api/pom.xml                                  | 2 +-
 server/container/mailbox-adapter/pom.xml                                | 2 +-
 server/container/mailbox-jmx/pom.xml                                    | 2 +-
 server/container/spring/pom.xml                                         | 2 +-
 server/container/util/pom.xml                                           | 2 +-
 server/data/data-api/pom.xml                                            | 2 +-
 server/data/data-cassandra/pom.xml                                      | 2 +-
 server/data/data-file/pom.xml                                           | 2 +-
 server/data/data-jdbc/pom.xml                                           | 2 +-
 server/data/data-jmap-cassandra/pom.xml                                 | 2 +-
 server/data/data-jmap/pom.xml                                           | 2 +-
 server/data/data-jpa/pom.xml                                            | 2 +-
 server/data/data-ldap/pom.xml                                           | 2 +-
 server/data/data-library/pom.xml                                        | 2 +-
 server/data/data-memory/pom.xml                                         | 2 +-
 server/dns-service/dnsservice-api/pom.xml                               | 2 +-
 server/dns-service/dnsservice-dnsjava/pom.xml                           | 2 +-
 server/dns-service/dnsservice-library/pom.xml                           | 2 +-
 server/dns-service/dnsservice-test/pom.xml                              | 2 +-
 server/mailet/dkim/pom.xml                                              | 2 +-
 server/mailet/integration-testing/pom.xml                               | 2 +-
 server/mailet/mailetcontainer-api/pom.xml                               | 2 +-
 server/mailet/mailetcontainer-impl/pom.xml                              | 2 +-
 server/mailet/mailets/pom.xml                                           | 2 +-
 server/mailet/mock-smtp-server/pom.xml                                  | 2 +-
 server/mailet/rate-limiter-redis/pom.xml                                | 2 +-
 server/mailet/rate-limiter/pom.xml                                      | 2 +-
 server/mailet/remote-delivery-integration-testing/pom.xml               | 2 +-
 server/mailrepository/mailrepository-api/pom.xml                        | 2 +-
 server/mailrepository/mailrepository-blob/pom.xml                       | 2 +-
 server/mailrepository/mailrepository-cassandra/pom.xml                  | 2 +-
 server/mailrepository/mailrepository-memory/pom.xml                     | 2 +-
 server/pom.xml                                                          | 2 +-
 server/protocols/fetchmail/pom.xml                                      | 2 +-
 .../jmap-draft-integration-testing-common/pom.xml                       | 2 +-
 .../memory-jmap-draft-integration-testing/pom.xml                       | 2 +-
 server/protocols/jmap-draft-integration-testing/pom.xml                 | 2 +-
 .../rabbitmq-jmap-draft-integration-testing/pom.xml                     | 2 +-
 server/protocols/jmap-draft/pom.xml                                     | 2 +-
 .../distributed-jmap-rfc-8621-integration-tests/pom.xml                 | 2 +-
 .../jmap-rfc-8621-integration-tests-common/pom.xml                      | 2 +-
 .../memory-jmap-rfc-8621-integration-tests/pom.xml                      | 2 +-
 server/protocols/jmap-rfc-8621-integration-tests/pom.xml                | 2 +-
 server/protocols/jmap-rfc-8621/pom.xml                                  | 2 +-
 server/protocols/jmap/pom.xml                                           | 2 +-
 server/protocols/jwt/pom.xml                                            | 2 +-
 server/protocols/protocols-imap4/pom.xml                                | 2 +-
 server/protocols/protocols-library/pom.xml                              | 2 +-
 server/protocols/protocols-lmtp/pom.xml                                 | 2 +-
 server/protocols/protocols-managesieve/pom.xml                          | 2 +-
 server/protocols/protocols-pop3-distributed/pom.xml                     | 2 +-
 server/protocols/protocols-pop3/pom.xml                                 | 2 +-
 server/protocols/protocols-smtp/pom.xml                                 | 2 +-
 .../distributed-webadmin-integration-test/pom.xml                       | 2 +-
 .../webadmin-integration-test/memory-webadmin-integration-test/pom.xml  | 2 +-
 server/protocols/webadmin-integration-test/pom.xml                      | 2 +-
 .../webadmin-integration-test/webadmin-integration-test-common/pom.xml  | 2 +-
 server/protocols/webadmin/pom.xml                                       | 2 +-
 server/protocols/webadmin/webadmin-cassandra-data/pom.xml               | 2 +-
 server/protocols/webadmin/webadmin-cassandra/pom.xml                    | 2 +-
 server/protocols/webadmin/webadmin-core/pom.xml                         | 2 +-
 server/protocols/webadmin/webadmin-data/pom.xml                         | 2 +-
 server/protocols/webadmin/webadmin-dropwizard-metrics/pom.xml           | 2 +-
 server/protocols/webadmin/webadmin-http-client/pom.xml                  | 2 +-
 server/protocols/webadmin/webadmin-jmap/pom.xml                         | 2 +-
 server/protocols/webadmin/webadmin-mail-over-web/pom.xml                | 2 +-
 .../protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml   | 2 +-
 server/protocols/webadmin/webadmin-mailbox/pom.xml                      | 2 +-
 server/protocols/webadmin/webadmin-mailqueue/pom.xml                    | 2 +-
 server/protocols/webadmin/webadmin-mailrepository/pom.xml               | 2 +-
 server/protocols/webadmin/webadmin-pop3/pom.xml                         | 2 +-
 server/protocols/webadmin/webadmin-rabbitmq/pom.xml                     | 2 +-
 server/queue/queue-activemq/pom.xml                                     | 2 +-
 server/queue/queue-api/pom.xml                                          | 2 +-
 server/queue/queue-jms/pom.xml                                          | 2 +-
 server/queue/queue-memory/pom.xml                                       | 2 +-
 server/queue/queue-pulsar/pom.xml                                       | 2 +-
 server/queue/queue-rabbitmq/pom.xml                                     | 2 +-
 server/task/task-api/pom.xml                                            | 2 +-
 server/task/task-distributed/pom.xml                                    | 2 +-
 server/task/task-json/pom.xml                                           | 2 +-
 server/task/task-memory/pom.xml                                         | 2 +-
 server/testing/pom.xml                                                  | 2 +-
 testing/base/pom.xml                                                    | 2 +-
 third-party/clamav/pom.xml                                              | 2 +-
 third-party/elasticsearch/pom.xml                                       | 2 +-
 third-party/linshare/pom.xml                                            | 2 +-
 third-party/pom.xml                                                     | 2 +-
 third-party/rspamd/pom.xml                                              | 2 +-
 third-party/spamassassin/pom.xml                                        | 2 +-
 260 files changed, 260 insertions(+), 260 deletions(-)

diff --git a/backends-common/cassandra/pom.xml b/backends-common/cassandra/pom.xml
index 8db1b53870..35f43f2e9b 100644
--- a/backends-common/cassandra/pom.xml
+++ b/backends-common/cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-backends-common</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-backends-cassandra</artifactId>
diff --git a/backends-common/jpa/pom.xml b/backends-common/jpa/pom.xml
index 754eb0ff8e..ef0681f24f 100644
--- a/backends-common/jpa/pom.xml
+++ b/backends-common/jpa/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-backends-common</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-backends-jpa</artifactId>
diff --git a/backends-common/opensearch/pom.xml b/backends-common/opensearch/pom.xml
index b52736792b..2dbde3f6f3 100644
--- a/backends-common/opensearch/pom.xml
+++ b/backends-common/opensearch/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-backends-common</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-backends-opensearch</artifactId>
diff --git a/backends-common/pom.xml b/backends-common/pom.xml
index 7305400122..4f7a681bd2 100644
--- a/backends-common/pom.xml
+++ b/backends-common/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-backends-common</artifactId>
diff --git a/backends-common/pulsar/pom.xml b/backends-common/pulsar/pom.xml
index 1e7b65af25..bcc469a186 100644
--- a/backends-common/pulsar/pom.xml
+++ b/backends-common/pulsar/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-backends-common</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-backends-pulsar</artifactId>
diff --git a/backends-common/rabbitmq/pom.xml b/backends-common/rabbitmq/pom.xml
index 3d6cef6ac7..7fe6f4443a 100644
--- a/backends-common/rabbitmq/pom.xml
+++ b/backends-common/rabbitmq/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-backends-common</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-backends-rabbitmq</artifactId>
diff --git a/code-coverage-report/pom.xml b/code-coverage-report/pom.xml
index dee6e040a1..556133ad85 100644
--- a/code-coverage-report/pom.xml
+++ b/code-coverage-report/pom.xml
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>code-coverage-report</artifactId>
diff --git a/core/pom.xml b/core/pom.xml
index 65c174846e..2c1c87b582 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-core</artifactId>
diff --git a/event-bus/api/pom.xml b/event-bus/api/pom.xml
index abf7457b8a..2c0a724c48 100644
--- a/event-bus/api/pom.xml
+++ b/event-bus/api/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-bus</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-bus-api</artifactId>
diff --git a/event-bus/cassandra/pom.xml b/event-bus/cassandra/pom.xml
index 7881d7273b..0bb8e223e3 100644
--- a/event-bus/cassandra/pom.xml
+++ b/event-bus/cassandra/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-bus</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>dead-letter-cassandra</artifactId>
diff --git a/event-bus/distributed/pom.xml b/event-bus/distributed/pom.xml
index 18e5ac996f..f129862a02 100644
--- a/event-bus/distributed/pom.xml
+++ b/event-bus/distributed/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-bus</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-bus-distributed</artifactId>
diff --git a/event-bus/in-vm/pom.xml b/event-bus/in-vm/pom.xml
index 3c22954e31..884f40c398 100644
--- a/event-bus/in-vm/pom.xml
+++ b/event-bus/in-vm/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-bus</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-bus-in-vm</artifactId>
diff --git a/event-bus/pom.xml b/event-bus/pom.xml
index 97a753cdaa..ab29577b7d 100644
--- a/event-bus/pom.xml
+++ b/event-bus/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-bus</artifactId>
diff --git a/event-sourcing/event-sourcing-core/pom.xml b/event-sourcing/event-sourcing-core/pom.xml
index 34057d881f..aec7a0f6a2 100644
--- a/event-sourcing/event-sourcing-core/pom.xml
+++ b/event-sourcing/event-sourcing-core/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-sourcing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-sourcing-core</artifactId>
diff --git a/event-sourcing/event-sourcing-pojo/pom.xml b/event-sourcing/event-sourcing-pojo/pom.xml
index dcf57b5212..96044813e8 100644
--- a/event-sourcing/event-sourcing-pojo/pom.xml
+++ b/event-sourcing/event-sourcing-pojo/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-sourcing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-sourcing-pojo</artifactId>
diff --git a/event-sourcing/event-store-api/pom.xml b/event-sourcing/event-store-api/pom.xml
index 0b07396cf3..b097b0ef7d 100644
--- a/event-sourcing/event-store-api/pom.xml
+++ b/event-sourcing/event-store-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-sourcing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-sourcing-event-store-api</artifactId>
diff --git a/event-sourcing/event-store-cassandra/pom.xml b/event-sourcing/event-store-cassandra/pom.xml
index a87ae48ca4..aee7ee3a45 100644
--- a/event-sourcing/event-store-cassandra/pom.xml
+++ b/event-sourcing/event-store-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-sourcing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-sourcing-event-store-cassandra</artifactId>
diff --git a/event-sourcing/event-store-memory/pom.xml b/event-sourcing/event-store-memory/pom.xml
index fdf3fff60f..e39f2c41cc 100644
--- a/event-sourcing/event-store-memory/pom.xml
+++ b/event-sourcing/event-store-memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>event-sourcing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>event-sourcing-event-store-memory</artifactId>
diff --git a/event-sourcing/pom.xml b/event-sourcing/pom.xml
index cbbad16225..d59b3802d5 100644
--- a/event-sourcing/pom.xml
+++ b/event-sourcing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
     <artifactId>event-sourcing</artifactId>
 
diff --git a/javax-mail-extension/pom.xml b/javax-mail-extension/pom.xml
index cf423c7f1f..84072642bc 100644
--- a/javax-mail-extension/pom.xml
+++ b/javax-mail-extension/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/json/pom.xml b/json/pom.xml
index f9f1d59218..40c065fd88 100644
--- a/json/pom.xml
+++ b/json/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-json</artifactId>
diff --git a/mailbox/api/pom.xml b/mailbox/api/pom.xml
index f500cc0ae8..77cd4173ff 100644
--- a/mailbox/api/pom.xml
+++ b/mailbox/api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/backup/pom.xml b/mailbox/backup/pom.xml
index 81aeee6c42..c277078b7b 100644
--- a/mailbox/backup/pom.xml
+++ b/mailbox/backup/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/cassandra/pom.xml b/mailbox/cassandra/pom.xml
index 139f79dde9..184a94537c 100644
--- a/mailbox/cassandra/pom.xml
+++ b/mailbox/cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/event/json/pom.xml b/mailbox/event/json/pom.xml
index 9a47dc24f3..f73d21a728 100644
--- a/mailbox/event/json/pom.xml
+++ b/mailbox/event/json/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/jpa/pom.xml b/mailbox/jpa/pom.xml
index 850b8befe7..67b76c21f6 100644
--- a/mailbox/jpa/pom.xml
+++ b/mailbox/jpa/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/lucene/pom.xml b/mailbox/lucene/pom.xml
index 63973d73de..eea9c86cc6 100644
--- a/mailbox/lucene/pom.xml
+++ b/mailbox/lucene/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/memory/pom.xml b/mailbox/memory/pom.xml
index e9c3090980..1cee6156e2 100644
--- a/mailbox/memory/pom.xml
+++ b/mailbox/memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/opensearch/pom.xml b/mailbox/opensearch/pom.xml
index b2317369b6..c3ffe54dbf 100644
--- a/mailbox/opensearch/pom.xml
+++ b/mailbox/opensearch/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/deleted-messages-vault-cassandra/pom.xml b/mailbox/plugin/deleted-messages-vault-cassandra/pom.xml
index 0b3c4433c6..77c97956b0 100644
--- a/mailbox/plugin/deleted-messages-vault-cassandra/pom.xml
+++ b/mailbox/plugin/deleted-messages-vault-cassandra/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/deleted-messages-vault/pom.xml b/mailbox/plugin/deleted-messages-vault/pom.xml
index 71f531cc23..6798b48829 100644
--- a/mailbox/plugin/deleted-messages-vault/pom.xml
+++ b/mailbox/plugin/deleted-messages-vault/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-mailing-cassandra/pom.xml b/mailbox/plugin/quota-mailing-cassandra/pom.xml
index f7ab772344..a89e27215f 100644
--- a/mailbox/plugin/quota-mailing-cassandra/pom.xml
+++ b/mailbox/plugin/quota-mailing-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-mailing-memory/pom.xml b/mailbox/plugin/quota-mailing-memory/pom.xml
index 4ad4b6f147..32c478b5be 100644
--- a/mailbox/plugin/quota-mailing-memory/pom.xml
+++ b/mailbox/plugin/quota-mailing-memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-mailing/pom.xml b/mailbox/plugin/quota-mailing/pom.xml
index 4e5b16d24d..83efe24ca4 100644
--- a/mailbox/plugin/quota-mailing/pom.xml
+++ b/mailbox/plugin/quota-mailing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-search-opensearch/pom.xml b/mailbox/plugin/quota-search-opensearch/pom.xml
index 467cf3f761..482a9c2325 100644
--- a/mailbox/plugin/quota-search-opensearch/pom.xml
+++ b/mailbox/plugin/quota-search-opensearch/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-search-scanning/pom.xml b/mailbox/plugin/quota-search-scanning/pom.xml
index 0769286637..a5acba0194 100644
--- a/mailbox/plugin/quota-search-scanning/pom.xml
+++ b/mailbox/plugin/quota-search-scanning/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/plugin/quota-search/pom.xml b/mailbox/plugin/quota-search/pom.xml
index 174c1f00c8..24a5d90417 100644
--- a/mailbox/plugin/quota-search/pom.xml
+++ b/mailbox/plugin/quota-search/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/pom.xml b/mailbox/pom.xml
index 3a51ac0228..bedf77355c 100644
--- a/mailbox/pom.xml
+++ b/mailbox/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mailbox</artifactId>
diff --git a/mailbox/scanning-search/pom.xml b/mailbox/scanning-search/pom.xml
index fba5c1a96b..33a3aaff2c 100644
--- a/mailbox/scanning-search/pom.xml
+++ b/mailbox/scanning-search/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/spring/pom.xml b/mailbox/spring/pom.xml
index 7fc2041581..01124d1d31 100644
--- a/mailbox/spring/pom.xml
+++ b/mailbox/spring/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/store/pom.xml b/mailbox/store/pom.xml
index 180bad4770..21e4b82bc0 100644
--- a/mailbox/store/pom.xml
+++ b/mailbox/store/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/tika/pom.xml b/mailbox/tika/pom.xml
index f1593fac74..6b1b7ba0ec 100644
--- a/mailbox/tika/pom.xml
+++ b/mailbox/tika/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
 
     </parent>
 
diff --git a/mailbox/tools/copier/pom.xml b/mailbox/tools/copier/pom.xml
index 9d169f87ff..8305b8723e 100644
--- a/mailbox/tools/copier/pom.xml
+++ b/mailbox/tools/copier/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/tools/indexer/pom.xml b/mailbox/tools/indexer/pom.xml
index 60864aa671..9709eca8d3 100644
--- a/mailbox/tools/indexer/pom.xml
+++ b/mailbox/tools/indexer/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/tools/jpa-migrator/pom.xml b/mailbox/tools/jpa-migrator/pom.xml
index d70edb8e72..98e2decaa0 100644
--- a/mailbox/tools/jpa-migrator/pom.xml
+++ b/mailbox/tools/jpa-migrator/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailbox/tools/quota-recompute/pom.xml b/mailbox/tools/quota-recompute/pom.xml
index 9c396ca662..9e6ceff0e2 100644
--- a/mailbox/tools/quota-recompute/pom.xml
+++ b/mailbox/tools/quota-recompute/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mailet/ai/pom.xml b/mailet/ai/pom.xml
index 0c1d4c81eb..f813eec593 100644
--- a/mailet/ai/pom.xml
+++ b/mailet/ai/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mailet/amqp/pom.xml b/mailet/amqp/pom.xml
index f1de5f8723..e27b9dea7a 100644
--- a/mailet/amqp/pom.xml
+++ b/mailet/amqp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/mailet/api/pom.xml b/mailet/api/pom.xml
index 65dd31075e..70887d0817 100644
--- a/mailet/api/pom.xml
+++ b/mailet/api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/mailet/base/pom.xml b/mailet/base/pom.xml
index 75fdb4dfd0..bbaebe0203 100644
--- a/mailet/base/pom.xml
+++ b/mailet/base/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/mailet/crypto/pom.xml b/mailet/crypto/pom.xml
index 3508f667fc..298cf68fbf 100644
--- a/mailet/crypto/pom.xml
+++ b/mailet/crypto/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/mailet/icalendar/pom.xml b/mailet/icalendar/pom.xml
index 88f7413e3d..a037f733e9 100644
--- a/mailet/icalendar/pom.xml
+++ b/mailet/icalendar/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-mailet-icalendar</artifactId>
diff --git a/mailet/mailetdocs-maven-plugin/pom.xml b/mailet/mailetdocs-maven-plugin/pom.xml
index f0c377ba14..c59c59cade 100644
--- a/mailet/mailetdocs-maven-plugin/pom.xml
+++ b/mailet/mailetdocs-maven-plugin/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>mailetdocs-maven-plugin</artifactId>
diff --git a/mailet/pom.xml b/mailet/pom.xml
index 491c4d94ba..f37f6efda1 100644
--- a/mailet/pom.xml
+++ b/mailet/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-mailet</artifactId>
diff --git a/mailet/standard/pom.xml b/mailet/standard/pom.xml
index 5770f45877..bcbed4b3a0 100644
--- a/mailet/standard/pom.xml
+++ b/mailet/standard/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/mailet/test/pom.xml b/mailet/test/pom.xml
index 9f843950df..d944d0d153 100644
--- a/mailet/test/pom.xml
+++ b/mailet/test/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-mailet</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mdn/pom.xml b/mdn/pom.xml
index 364862744d..126f7856d5 100644
--- a/mdn/pom.xml
+++ b/mdn/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-mdn</artifactId>
diff --git a/metrics/metrics-api/pom.xml b/metrics/metrics-api/pom.xml
index eb04404bf9..edb831b068 100644
--- a/metrics/metrics-api/pom.xml
+++ b/metrics/metrics-api/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>metrics</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics-api</artifactId>
diff --git a/metrics/metrics-dropwizard/pom.xml b/metrics/metrics-dropwizard/pom.xml
index 319c6fb418..ac473d8b13 100644
--- a/metrics/metrics-dropwizard/pom.xml
+++ b/metrics/metrics-dropwizard/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>metrics</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics-dropwizard</artifactId>
diff --git a/metrics/metrics-logger/pom.xml b/metrics/metrics-logger/pom.xml
index 050bfcdba2..1a4481dcf2 100644
--- a/metrics/metrics-logger/pom.xml
+++ b/metrics/metrics-logger/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>metrics</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics-logger</artifactId>
diff --git a/metrics/metrics-tests/pom.xml b/metrics/metrics-tests/pom.xml
index 5b46769a6b..7ab427ebc0 100644
--- a/metrics/metrics-tests/pom.xml
+++ b/metrics/metrics-tests/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>metrics</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics-tests</artifactId>
diff --git a/metrics/pom.xml b/metrics/pom.xml
index 546d462389..6d7eec78c8 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics</artifactId>
diff --git a/mpt/all/pom.xml b/mpt/all/pom.xml
index 0d5df27979..79348eb5af 100644
--- a/mpt/all/pom.xml
+++ b/mpt/all/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>apache-james-mpt-all</artifactId>
diff --git a/mpt/app/pom.xml b/mpt/app/pom.xml
index c52f5bcf35..528dfdc2e5 100644
--- a/mpt/app/pom.xml
+++ b/mpt/app/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mpt/core/pom.xml b/mpt/core/pom.xml
index 948978b844..f84957d132 100644
--- a/mpt/core/pom.xml
+++ b/mpt/core/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>apache-james-mpt-core</artifactId>
diff --git a/mpt/impl/imap-mailbox/cassandra/pom.xml b/mpt/impl/imap-mailbox/cassandra/pom.xml
index cd693da5be..886b2c56e7 100644
--- a/mpt/impl/imap-mailbox/cassandra/pom.xml
+++ b/mpt/impl/imap-mailbox/cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-cassandra</artifactId>
diff --git a/mpt/impl/imap-mailbox/core/pom.xml b/mpt/impl/imap-mailbox/core/pom.xml
index 04fea22047..c876b6fc2f 100644
--- a/mpt/impl/imap-mailbox/core/pom.xml
+++ b/mpt/impl/imap-mailbox/core/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-core</artifactId>
diff --git a/mpt/impl/imap-mailbox/cyrus/pom.xml b/mpt/impl/imap-mailbox/cyrus/pom.xml
index 10348e1d12..2de7d1a5dc 100644
--- a/mpt/impl/imap-mailbox/cyrus/pom.xml
+++ b/mpt/impl/imap-mailbox/cyrus/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-cyrus</artifactId>
diff --git a/mpt/impl/imap-mailbox/external-james/pom.xml b/mpt/impl/imap-mailbox/external-james/pom.xml
index c1a02602c7..c9ff3661f7 100644
--- a/mpt/impl/imap-mailbox/external-james/pom.xml
+++ b/mpt/impl/imap-mailbox/external-james/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-external-james</artifactId>
diff --git a/mpt/impl/imap-mailbox/inmemory/pom.xml b/mpt/impl/imap-mailbox/inmemory/pom.xml
index 3b3e07c014..4b235ee25f 100644
--- a/mpt/impl/imap-mailbox/inmemory/pom.xml
+++ b/mpt/impl/imap-mailbox/inmemory/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-inmemory</artifactId>
diff --git a/mpt/impl/imap-mailbox/jpa/pom.xml b/mpt/impl/imap-mailbox/jpa/pom.xml
index 6a27c67be8..a966c5b94c 100644
--- a/mpt/impl/imap-mailbox/jpa/pom.xml
+++ b/mpt/impl/imap-mailbox/jpa/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-jpa</artifactId>
diff --git a/mpt/impl/imap-mailbox/lucenesearch/pom.xml b/mpt/impl/imap-mailbox/lucenesearch/pom.xml
index 987e23f21d..e350801f1c 100644
--- a/mpt/impl/imap-mailbox/lucenesearch/pom.xml
+++ b/mpt/impl/imap-mailbox/lucenesearch/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-jpa-lucene</artifactId>
diff --git a/mpt/impl/imap-mailbox/opensearch/pom.xml b/mpt/impl/imap-mailbox/opensearch/pom.xml
index e81adf38d5..2d6d97f2e0 100644
--- a/mpt/impl/imap-mailbox/opensearch/pom.xml
+++ b/mpt/impl/imap-mailbox/opensearch/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-opensearch</artifactId>
diff --git a/mpt/impl/imap-mailbox/pom.xml b/mpt/impl/imap-mailbox/pom.xml
index 13516a9fa2..d3a2de6b68 100644
--- a/mpt/impl/imap-mailbox/pom.xml
+++ b/mpt/impl/imap-mailbox/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../..</relativePath>
     </parent>
 
diff --git a/mpt/impl/imap-mailbox/rabbitmq/pom.xml b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
index 0e0fa3a76e..d9be5c3f44 100644
--- a/mpt/impl/imap-mailbox/rabbitmq/pom.xml
+++ b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-imapmailbox</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-imapmailbox-rabbitmq</artifactId>
diff --git a/mpt/impl/managesieve/cassandra/pom.xml b/mpt/impl/managesieve/cassandra/pom.xml
index eaf4fc8566..c65a4199cf 100644
--- a/mpt/impl/managesieve/cassandra/pom.xml
+++ b/mpt/impl/managesieve/cassandra/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-managesieve</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
diff --git a/mpt/impl/managesieve/core/pom.xml b/mpt/impl/managesieve/core/pom.xml
index aab2590e31..0a53d8b6a5 100644
--- a/mpt/impl/managesieve/core/pom.xml
+++ b/mpt/impl/managesieve/core/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-managesieve</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-managesieve-core</artifactId>
diff --git a/mpt/impl/managesieve/file/pom.xml b/mpt/impl/managesieve/file/pom.xml
index 7a9330b989..ced241ac52 100644
--- a/mpt/impl/managesieve/file/pom.xml
+++ b/mpt/impl/managesieve/file/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-managesieve</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
diff --git a/mpt/impl/managesieve/pom.xml b/mpt/impl/managesieve/pom.xml
index 7f99765972..4ffda84049 100644
--- a/mpt/impl/managesieve/pom.xml
+++ b/mpt/impl/managesieve/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/mpt/impl/smtp/cassandra-pulsar/pom.xml b/mpt/impl/smtp/cassandra-pulsar/pom.xml
index a6407535c4..de8bc496b4 100644
--- a/mpt/impl/smtp/cassandra-pulsar/pom.xml
+++ b/mpt/impl/smtp/cassandra-pulsar/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-smtp</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-smtp-cassandra-pulsar</artifactId>
diff --git a/mpt/impl/smtp/cassandra-rabbitmq-object-storage/pom.xml b/mpt/impl/smtp/cassandra-rabbitmq-object-storage/pom.xml
index b63653d2fb..80eebe42f2 100644
--- a/mpt/impl/smtp/cassandra-rabbitmq-object-storage/pom.xml
+++ b/mpt/impl/smtp/cassandra-rabbitmq-object-storage/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-smtp</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-smtp-cassandra-rabbitmq-object-storage</artifactId>
diff --git a/mpt/impl/smtp/cassandra/pom.xml b/mpt/impl/smtp/cassandra/pom.xml
index c20444737d..8296cbb634 100644
--- a/mpt/impl/smtp/cassandra/pom.xml
+++ b/mpt/impl/smtp/cassandra/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-smtp</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-smtp-cassandra</artifactId>
diff --git a/mpt/impl/smtp/core/pom.xml b/mpt/impl/smtp/core/pom.xml
index 73f343e89e..f91f9553a7 100644
--- a/mpt/impl/smtp/core/pom.xml
+++ b/mpt/impl/smtp/core/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt-smtp</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt-smtp-core</artifactId>
diff --git a/mpt/impl/smtp/pom.xml b/mpt/impl/smtp/pom.xml
index e52c1d5d3c..52b3028be8 100644
--- a/mpt/impl/smtp/pom.xml
+++ b/mpt/impl/smtp/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../..</relativePath>
     </parent>
 
diff --git a/mpt/mavenplugin/pom.xml b/mpt/mavenplugin/pom.xml
index 0904c53f0f..95a978f744 100644
--- a/mpt/mavenplugin/pom.xml
+++ b/mpt/mavenplugin/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-mpt</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/mpt/pom.xml b/mpt/pom.xml
index bc5f11caa6..cc619d4154 100644
--- a/mpt/pom.xml
+++ b/mpt/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-mpt</artifactId>
diff --git a/pom.xml b/pom.xml
index 027c0f4a82..5abb95fa18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 
     <groupId>org.apache.james</groupId>
     <artifactId>james-project</artifactId>
-    <version>3.8.0</version>
+    <version>3.8.1-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>Apache James Project</name>
diff --git a/protocols/api/pom.xml b/protocols/api/pom.xml
index e2f9dfbed0..5e6efcf229 100644
--- a/protocols/api/pom.xml
+++ b/protocols/api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/imap/pom.xml b/protocols/imap/pom.xml
index 12f7d19f52..878f2ccffd 100644
--- a/protocols/imap/pom.xml
+++ b/protocols/imap/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/lmtp/pom.xml b/protocols/lmtp/pom.xml
index a40008f60b..1c32848822 100644
--- a/protocols/lmtp/pom.xml
+++ b/protocols/lmtp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/managesieve/pom.xml b/protocols/managesieve/pom.xml
index 3dd1c3dd89..eebc9add70 100644
--- a/protocols/managesieve/pom.xml
+++ b/protocols/managesieve/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/netty/pom.xml b/protocols/netty/pom.xml
index bfea50eb75..cef11e2a57 100644
--- a/protocols/netty/pom.xml
+++ b/protocols/netty/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/pom.xml b/protocols/pom.xml
index 27c93e271d..4644eb1d8b 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <groupId>org.apache.james.protocols</groupId>
diff --git a/protocols/pop3/pom.xml b/protocols/pop3/pom.xml
index 22380f5dc1..f0470cc25b 100644
--- a/protocols/pop3/pom.xml
+++ b/protocols/pop3/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/protocols/smtp/pom.xml b/protocols/smtp/pom.xml
index 2c29082fa4..bceb91635b 100644
--- a/protocols/smtp/pom.xml
+++ b/protocols/smtp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.protocols</groupId>
         <artifactId>protocols</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/cassandra-app/pom.xml b/server/apps/cassandra-app/pom.xml
index 68716475a1..0568fb7a08 100644
--- a/server/apps/cassandra-app/pom.xml
+++ b/server/apps/cassandra-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/cli-integration-tests/pom.xml b/server/apps/cli-integration-tests/pom.xml
index c42576e797..15d869338b 100644
--- a/server/apps/cli-integration-tests/pom.xml
+++ b/server/apps/cli-integration-tests/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/cli/pom.xml b/server/apps/cli/pom.xml
index bcf8831345..d3ffebd9cc 100644
--- a/server/apps/cli/pom.xml
+++ b/server/apps/cli/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/distributed-app/pom.xml b/server/apps/distributed-app/pom.xml
index ba95bb939e..8ea7607a6e 100644
--- a/server/apps/distributed-app/pom.xml
+++ b/server/apps/distributed-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/distributed-pop3-app/pom.xml b/server/apps/distributed-pop3-app/pom.xml
index c507c7a55f..60993ed725 100644
--- a/server/apps/distributed-pop3-app/pom.xml
+++ b/server/apps/distributed-pop3-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/jpa-app/pom.xml b/server/apps/jpa-app/pom.xml
index 83d3fc3ab5..a5619aba62 100644
--- a/server/apps/jpa-app/pom.xml
+++ b/server/apps/jpa-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/jpa-smtp-app/pom.xml b/server/apps/jpa-smtp-app/pom.xml
index 73c3d50dd6..131d6c20e3 100644
--- a/server/apps/jpa-smtp-app/pom.xml
+++ b/server/apps/jpa-smtp-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/memory-app/pom.xml b/server/apps/memory-app/pom.xml
index f0d2b9900d..3d40d806e1 100644
--- a/server/apps/memory-app/pom.xml
+++ b/server/apps/memory-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/scaling-pulsar-smtp/pom.xml b/server/apps/scaling-pulsar-smtp/pom.xml
index 2e64b3bf94..77e2546b67 100644
--- a/server/apps/scaling-pulsar-smtp/pom.xml
+++ b/server/apps/scaling-pulsar-smtp/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/spring-app/pom.xml b/server/apps/spring-app/pom.xml
index edf54e0914..efdc369407 100644
--- a/server/apps/spring-app/pom.xml
+++ b/server/apps/spring-app/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/apps/webadmin-cli/pom.xml b/server/apps/webadmin-cli/pom.xml
index 5f5d1d36bd..a21d96b2b1 100644
--- a/server/apps/webadmin-cli/pom.xml
+++ b/server/apps/webadmin-cli/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
     <artifactId>webadmin-cli</artifactId>
diff --git a/server/blob/blob-aes/pom.xml b/server/blob/blob-aes/pom.xml
index a7fd7a93ba..3a3a93ffc8 100644
--- a/server/blob/blob-aes/pom.xml
+++ b/server/blob/blob-aes/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-api/pom.xml b/server/blob/blob-api/pom.xml
index 58a3e5da25..3405e0138f 100644
--- a/server/blob/blob-api/pom.xml
+++ b/server/blob/blob-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-cassandra/pom.xml b/server/blob/blob-cassandra/pom.xml
index 9c88277712..c34a5f36d6 100644
--- a/server/blob/blob-cassandra/pom.xml
+++ b/server/blob/blob-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-common/pom.xml b/server/blob/blob-common/pom.xml
index 2dbb4ce3de..419db8accf 100644
--- a/server/blob/blob-common/pom.xml
+++ b/server/blob/blob-common/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-export-api/pom.xml b/server/blob/blob-export-api/pom.xml
index d092d74f63..d11df3033b 100644
--- a/server/blob/blob-export-api/pom.xml
+++ b/server/blob/blob-export-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-export-file/pom.xml b/server/blob/blob-export-file/pom.xml
index 2e040febe4..997d985eab 100644
--- a/server/blob/blob-export-file/pom.xml
+++ b/server/blob/blob-export-file/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-memory/pom.xml b/server/blob/blob-memory/pom.xml
index 9dcfdfb460..346783018e 100644
--- a/server/blob/blob-memory/pom.xml
+++ b/server/blob/blob-memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-s3/pom.xml b/server/blob/blob-s3/pom.xml
index bc35018718..bd07699f59 100644
--- a/server/blob/blob-s3/pom.xml
+++ b/server/blob/blob-s3/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/blob-storage-strategy/pom.xml b/server/blob/blob-storage-strategy/pom.xml
index 220cb49b01..51eb3bb0cd 100644
--- a/server/blob/blob-storage-strategy/pom.xml
+++ b/server/blob/blob-storage-strategy/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/mail-store/pom.xml b/server/blob/mail-store/pom.xml
index b1ebdac906..1d1019ebef 100644
--- a/server/blob/mail-store/pom.xml
+++ b/server/blob/mail-store/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-blob</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/blob/pom.xml b/server/blob/pom.xml
index f8c283ae39..c6e10d6398 100644
--- a/server/blob/pom.xml
+++ b/server/blob/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/core/pom.xml b/server/container/core/pom.xml
index 7ba0be0eb5..6851e41f0d 100644
--- a/server/container/core/pom.xml
+++ b/server/container/core/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/feature-checks/pom.xml b/server/container/feature-checks/pom.xml
index 113a494616..8cbe4ca295 100644
--- a/server/container/feature-checks/pom.xml
+++ b/server/container/feature-checks/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/filesystem-api/pom.xml b/server/container/filesystem-api/pom.xml
index af5a0af6ad..785d8520a9 100644
--- a/server/container/filesystem-api/pom.xml
+++ b/server/container/filesystem-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/blob/api/pom.xml b/server/container/guice/blob/api/pom.xml
index b9400fad33..ab2e0ee88d 100644
--- a/server/container/guice/blob/api/pom.xml
+++ b/server/container/guice/blob/api/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/blob/deduplication-gc/pom.xml b/server/container/guice/blob/deduplication-gc/pom.xml
index 52e03b17ed..a73e2b9be2 100644
--- a/server/container/guice/blob/deduplication-gc/pom.xml
+++ b/server/container/guice/blob/deduplication-gc/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/blob/export/pom.xml b/server/container/guice/blob/export/pom.xml
index 4c8943529f..0ab466d081 100644
--- a/server/container/guice/blob/export/pom.xml
+++ b/server/container/guice/blob/export/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/blob/memory/pom.xml b/server/container/guice/blob/memory/pom.xml
index 142c117e90..64116366cb 100644
--- a/server/container/guice/blob/memory/pom.xml
+++ b/server/container/guice/blob/memory/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/blob/s3/pom.xml b/server/container/guice/blob/s3/pom.xml
index f24d42937a..d9ff0d472b 100644
--- a/server/container/guice/blob/s3/pom.xml
+++ b/server/container/guice/blob/s3/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/cassandra/pom.xml b/server/container/guice/cassandra/pom.xml
index 744fb8106f..a00db46f01 100644
--- a/server/container/guice/cassandra/pom.xml
+++ b/server/container/guice/cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/common/pom.xml b/server/container/guice/common/pom.xml
index b62e6ccbbd..0f3ebdc22c 100644
--- a/server/container/guice/common/pom.xml
+++ b/server/container/guice/common/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/configuration/pom.xml b/server/container/guice/configuration/pom.xml
index ebce0975e5..a079db27dd 100644
--- a/server/container/guice/configuration/pom.xml
+++ b/server/container/guice/configuration/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/data-cassandra/pom.xml b/server/container/guice/data-cassandra/pom.xml
index de68da60e7..bd310087ba 100644
--- a/server/container/guice/data-cassandra/pom.xml
+++ b/server/container/guice/data-cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/data-ldap/pom.xml b/server/container/guice/data-ldap/pom.xml
index e76b7ec963..8117f143ee 100644
--- a/server/container/guice/data-ldap/pom.xml
+++ b/server/container/guice/data-ldap/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/distributed/pom.xml b/server/container/guice/distributed/pom.xml
index 34f7fb9511..6c5e826124 100644
--- a/server/container/guice/distributed/pom.xml
+++ b/server/container/guice/distributed/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/jmx/pom.xml b/server/container/guice/jmx/pom.xml
index c420af0f3f..b70339e71e 100644
--- a/server/container/guice/jmx/pom.xml
+++ b/server/container/guice/jmx/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/jpa-common/pom.xml b/server/container/guice/jpa-common/pom.xml
index 1e76fe1b14..0082c8e595 100644
--- a/server/container/guice/jpa-common/pom.xml
+++ b/server/container/guice/jpa-common/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailbox-jpa/pom.xml b/server/container/guice/mailbox-jpa/pom.xml
index a3a3d0b168..c493624e9f 100644
--- a/server/container/guice/mailbox-jpa/pom.xml
+++ b/server/container/guice/mailbox-jpa/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailbox-plugin-deleted-messages-vault/pom.xml b/server/container/guice/mailbox-plugin-deleted-messages-vault/pom.xml
index 56ee2e68c2..03baa88c62 100644
--- a/server/container/guice/mailbox-plugin-deleted-messages-vault/pom.xml
+++ b/server/container/guice/mailbox-plugin-deleted-messages-vault/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailbox/pom.xml b/server/container/guice/mailbox/pom.xml
index 3caa41a2d7..e995d2de41 100644
--- a/server/container/guice/mailbox/pom.xml
+++ b/server/container/guice/mailbox/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailet/pom.xml b/server/container/guice/mailet/pom.xml
index 4cb6364c94..49939dce00 100644
--- a/server/container/guice/mailet/pom.xml
+++ b/server/container/guice/mailet/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailrepository-blob/pom.xml b/server/container/guice/mailrepository-blob/pom.xml
index d1b11667f9..a63a202b1a 100644
--- a/server/container/guice/mailrepository-blob/pom.xml
+++ b/server/container/guice/mailrepository-blob/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailrepository-cassandra/pom.xml b/server/container/guice/mailrepository-cassandra/pom.xml
index 9311a1f8b7..7cdf51afbe 100644
--- a/server/container/guice/mailrepository-cassandra/pom.xml
+++ b/server/container/guice/mailrepository-cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/mailrepository-loaders/pom.xml b/server/container/guice/mailrepository-loaders/pom.xml
index f1288a449d..bb9eb286c7 100644
--- a/server/container/guice/mailrepository-loaders/pom.xml
+++ b/server/container/guice/mailrepository-loaders/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/memory/pom.xml b/server/container/guice/memory/pom.xml
index 932d9af393..477e45ea61 100644
--- a/server/container/guice/memory/pom.xml
+++ b/server/container/guice/memory/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/onami/pom.xml b/server/container/guice/onami/pom.xml
index 03dd388e91..98d3fc84c8 100644
--- a/server/container/guice/onami/pom.xml
+++ b/server/container/guice/onami/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-server-onami</artifactId>
diff --git a/server/container/guice/opensearch/pom.xml b/server/container/guice/opensearch/pom.xml
index 6baffedce8..bafdd6327e 100644
--- a/server/container/guice/opensearch/pom.xml
+++ b/server/container/guice/opensearch/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 22184ed9a3..beb6303298 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/imap/pom.xml b/server/container/guice/protocols/imap/pom.xml
index 36b604166f..376f876405 100644
--- a/server/container/guice/protocols/imap/pom.xml
+++ b/server/container/guice/protocols/imap/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/jmap/pom.xml b/server/container/guice/protocols/jmap/pom.xml
index 5eda4243fd..d39027107c 100644
--- a/server/container/guice/protocols/jmap/pom.xml
+++ b/server/container/guice/protocols/jmap/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/lmtp/pom.xml b/server/container/guice/protocols/lmtp/pom.xml
index 08aa7da7c8..8005c42a44 100644
--- a/server/container/guice/protocols/lmtp/pom.xml
+++ b/server/container/guice/protocols/lmtp/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/managedsieve/pom.xml b/server/container/guice/protocols/managedsieve/pom.xml
index 0a48fd1012..3a110d4c52 100644
--- a/server/container/guice/protocols/managedsieve/pom.xml
+++ b/server/container/guice/protocols/managedsieve/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/netty/pom.xml b/server/container/guice/protocols/netty/pom.xml
index 142e859043..dbf59b8b61 100644
--- a/server/container/guice/protocols/netty/pom.xml
+++ b/server/container/guice/protocols/netty/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/pop/pom.xml b/server/container/guice/protocols/pop/pom.xml
index 49255681ce..077f7137da 100644
--- a/server/container/guice/protocols/pop/pom.xml
+++ b/server/container/guice/protocols/pop/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/smtp/pom.xml b/server/container/guice/protocols/smtp/pom.xml
index d0494b7b19..43f13a39e9 100644
--- a/server/container/guice/protocols/smtp/pom.xml
+++ b/server/container/guice/protocols/smtp/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-data/pom.xml b/server/container/guice/protocols/webadmin-data/pom.xml
index c70b2cd3f4..5493895475 100644
--- a/server/container/guice/protocols/webadmin-data/pom.xml
+++ b/server/container/guice/protocols/webadmin-data/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-jmap/pom.xml b/server/container/guice/protocols/webadmin-jmap/pom.xml
index a382b0358f..c235d99375 100644
--- a/server/container/guice/protocols/webadmin-jmap/pom.xml
+++ b/server/container/guice/protocols/webadmin-jmap/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-mail-over-web/pom.xml b/server/container/guice/protocols/webadmin-mail-over-web/pom.xml
index 04fd7bb804..51468838eb 100644
--- a/server/container/guice/protocols/webadmin-mail-over-web/pom.xml
+++ b/server/container/guice/protocols/webadmin-mail-over-web/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-mailbox/pom.xml b/server/container/guice/protocols/webadmin-mailbox/pom.xml
index 71bcb793c7..e43df00545 100644
--- a/server/container/guice/protocols/webadmin-mailbox/pom.xml
+++ b/server/container/guice/protocols/webadmin-mailbox/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-mailqueue/pom.xml b/server/container/guice/protocols/webadmin-mailqueue/pom.xml
index 6f7f5a61e1..d454d4a461 100644
--- a/server/container/guice/protocols/webadmin-mailqueue/pom.xml
+++ b/server/container/guice/protocols/webadmin-mailqueue/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-mailrepository/pom.xml b/server/container/guice/protocols/webadmin-mailrepository/pom.xml
index 004058a516..d721d9818b 100644
--- a/server/container/guice/protocols/webadmin-mailrepository/pom.xml
+++ b/server/container/guice/protocols/webadmin-mailrepository/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin-rabbitmq-mailqueue/pom.xml b/server/container/guice/protocols/webadmin-rabbitmq-mailqueue/pom.xml
index 3a37b92112..b42c281c01 100644
--- a/server/container/guice/protocols/webadmin-rabbitmq-mailqueue/pom.xml
+++ b/server/container/guice/protocols/webadmin-rabbitmq-mailqueue/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/protocols/webadmin/pom.xml b/server/container/guice/protocols/webadmin/pom.xml
index fa1e97500d..d59a0e8923 100644
--- a/server/container/guice/protocols/webadmin/pom.xml
+++ b/server/container/guice/protocols/webadmin/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/queue/activemq/pom.xml b/server/container/guice/queue/activemq/pom.xml
index 99284a4ea7..83962973eb 100644
--- a/server/container/guice/queue/activemq/pom.xml
+++ b/server/container/guice/queue/activemq/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/queue/memory/pom.xml b/server/container/guice/queue/memory/pom.xml
index 404c8e3fa7..06918085ed 100644
--- a/server/container/guice/queue/memory/pom.xml
+++ b/server/container/guice/queue/memory/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/queue/pulsar/pom.xml b/server/container/guice/queue/pulsar/pom.xml
index 0a77f386fc..b3c246275f 100644
--- a/server/container/guice/queue/pulsar/pom.xml
+++ b/server/container/guice/queue/pulsar/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/queue/rabbitmq/pom.xml b/server/container/guice/queue/rabbitmq/pom.xml
index f50a9fc72b..21d04726e2 100644
--- a/server/container/guice/queue/rabbitmq/pom.xml
+++ b/server/container/guice/queue/rabbitmq/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/sieve-file/pom.xml b/server/container/guice/sieve-file/pom.xml
index e78e7a806d..83087cbbad 100644
--- a/server/container/guice/sieve-file/pom.xml
+++ b/server/container/guice/sieve-file/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-server-guice-sieve-file</artifactId>
diff --git a/server/container/guice/sieve-jpa/pom.xml b/server/container/guice/sieve-jpa/pom.xml
index 1b76483765..9e9eecd748 100644
--- a/server/container/guice/sieve-jpa/pom.xml
+++ b/server/container/guice/sieve-jpa/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-server-guice-sieve-jpa</artifactId>
diff --git a/server/container/guice/testing/custom-mailets-implementation/pom.xml b/server/container/guice/testing/custom-mailets-implementation/pom.xml
index dfe32b88a9..bf6f3955b0 100644
--- a/server/container/guice/testing/custom-mailets-implementation/pom.xml
+++ b/server/container/guice/testing/custom-mailets-implementation/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/testing/custom-mailets/pom.xml b/server/container/guice/testing/custom-mailets/pom.xml
index a4d61f4741..2e3ace81d6 100644
--- a/server/container/guice/testing/custom-mailets/pom.xml
+++ b/server/container/guice/testing/custom-mailets/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/testing/dependency/pom.xml b/server/container/guice/testing/dependency/pom.xml
index 039dab3446..c19b54e1aa 100644
--- a/server/container/guice/testing/dependency/pom.xml
+++ b/server/container/guice/testing/dependency/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/testing/pom.xml b/server/container/guice/testing/pom.xml
index cbc29da6a2..2c1a698b66 100644
--- a/server/container/guice/testing/pom.xml
+++ b/server/container/guice/testing/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/guice/utils/pom.xml b/server/container/guice/utils/pom.xml
index e0df6f5fdc..7b3cafb6e5 100644
--- a/server/container/guice/utils/pom.xml
+++ b/server/container/guice/utils/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/lifecycle-api/pom.xml b/server/container/lifecycle-api/pom.xml
index 08ee7c7d8a..edaa8a2810 100644
--- a/server/container/lifecycle-api/pom.xml
+++ b/server/container/lifecycle-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/mailbox-adapter/pom.xml b/server/container/mailbox-adapter/pom.xml
index 9a1a717a51..9b3ed07bf2 100644
--- a/server/container/mailbox-adapter/pom.xml
+++ b/server/container/mailbox-adapter/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/mailbox-jmx/pom.xml b/server/container/mailbox-jmx/pom.xml
index 3de9dc35e9..61f0935ebb 100644
--- a/server/container/mailbox-jmx/pom.xml
+++ b/server/container/mailbox-jmx/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/spring/pom.xml b/server/container/spring/pom.xml
index 8fc6ff695a..6d830ff256 100644
--- a/server/container/spring/pom.xml
+++ b/server/container/spring/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/container/util/pom.xml b/server/container/util/pom.xml
index a4b07bab81..68b100ec4c 100644
--- a/server/container/util/pom.xml
+++ b/server/container/util/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-api/pom.xml b/server/data/data-api/pom.xml
index cdd061bc54..d9cb983749 100644
--- a/server/data/data-api/pom.xml
+++ b/server/data/data-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-cassandra/pom.xml b/server/data/data-cassandra/pom.xml
index a7199e490a..6f8c78d2b0 100644
--- a/server/data/data-cassandra/pom.xml
+++ b/server/data/data-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-file/pom.xml b/server/data/data-file/pom.xml
index ba1fc6e3f1..0ae8569c36 100644
--- a/server/data/data-file/pom.xml
+++ b/server/data/data-file/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-jdbc/pom.xml b/server/data/data-jdbc/pom.xml
index 16ff6c1385..f75b03b7cd 100644
--- a/server/data/data-jdbc/pom.xml
+++ b/server/data/data-jdbc/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-jmap-cassandra/pom.xml b/server/data/data-jmap-cassandra/pom.xml
index 5ef11f68f8..f143d7fd42 100644
--- a/server/data/data-jmap-cassandra/pom.xml
+++ b/server/data/data-jmap-cassandra/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-jmap/pom.xml b/server/data/data-jmap/pom.xml
index 909fad4dfe..c9d72bccd4 100644
--- a/server/data/data-jmap/pom.xml
+++ b/server/data/data-jmap/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-jpa/pom.xml b/server/data/data-jpa/pom.xml
index 13a0a0c632..c26b29b8a2 100644
--- a/server/data/data-jpa/pom.xml
+++ b/server/data/data-jpa/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-ldap/pom.xml b/server/data/data-ldap/pom.xml
index 17e1594ee4..62a5cfe102 100644
--- a/server/data/data-ldap/pom.xml
+++ b/server/data/data-ldap/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-library/pom.xml b/server/data/data-library/pom.xml
index 463f9dfae6..bb7f643f07 100644
--- a/server/data/data-library/pom.xml
+++ b/server/data/data-library/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/data/data-memory/pom.xml b/server/data/data-memory/pom.xml
index fdcaa33c5a..694a386383 100644
--- a/server/data/data-memory/pom.xml
+++ b/server/data/data-memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/dns-service/dnsservice-api/pom.xml b/server/dns-service/dnsservice-api/pom.xml
index 0a9335abde..481e1af056 100644
--- a/server/dns-service/dnsservice-api/pom.xml
+++ b/server/dns-service/dnsservice-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/dns-service/dnsservice-dnsjava/pom.xml b/server/dns-service/dnsservice-dnsjava/pom.xml
index e91b313287..1be56dd7d8 100644
--- a/server/dns-service/dnsservice-dnsjava/pom.xml
+++ b/server/dns-service/dnsservice-dnsjava/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/dns-service/dnsservice-library/pom.xml b/server/dns-service/dnsservice-library/pom.xml
index 47bb317af7..9c1a1693e1 100644
--- a/server/dns-service/dnsservice-library/pom.xml
+++ b/server/dns-service/dnsservice-library/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/dns-service/dnsservice-test/pom.xml b/server/dns-service/dnsservice-test/pom.xml
index 541a74c452..7c69d3b25d 100644
--- a/server/dns-service/dnsservice-test/pom.xml
+++ b/server/dns-service/dnsservice-test/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/dkim/pom.xml b/server/mailet/dkim/pom.xml
index 7c310dbf77..24c7def985 100644
--- a/server/mailet/dkim/pom.xml
+++ b/server/mailet/dkim/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/integration-testing/pom.xml b/server/mailet/integration-testing/pom.xml
index 15c0748e29..3152665a08 100644
--- a/server/mailet/integration-testing/pom.xml
+++ b/server/mailet/integration-testing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/mailetcontainer-api/pom.xml b/server/mailet/mailetcontainer-api/pom.xml
index 3fa3cdab72..463619c798 100644
--- a/server/mailet/mailetcontainer-api/pom.xml
+++ b/server/mailet/mailetcontainer-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/mailetcontainer-impl/pom.xml b/server/mailet/mailetcontainer-impl/pom.xml
index 6c4ca133dc..e97e45b629 100644
--- a/server/mailet/mailetcontainer-impl/pom.xml
+++ b/server/mailet/mailetcontainer-impl/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/mailets/pom.xml b/server/mailet/mailets/pom.xml
index 594ee057a3..0a6c21aefe 100644
--- a/server/mailet/mailets/pom.xml
+++ b/server/mailet/mailets/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/mock-smtp-server/pom.xml b/server/mailet/mock-smtp-server/pom.xml
index 63e96cb876..1819401a00 100644
--- a/server/mailet/mock-smtp-server/pom.xml
+++ b/server/mailet/mock-smtp-server/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/rate-limiter-redis/pom.xml b/server/mailet/rate-limiter-redis/pom.xml
index 721dfb7ed6..e5fe28fdd3 100644
--- a/server/mailet/rate-limiter-redis/pom.xml
+++ b/server/mailet/rate-limiter-redis/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/rate-limiter/pom.xml b/server/mailet/rate-limiter/pom.xml
index f8f6f1cbfb..9d2180d701 100644
--- a/server/mailet/rate-limiter/pom.xml
+++ b/server/mailet/rate-limiter/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailet/remote-delivery-integration-testing/pom.xml b/server/mailet/remote-delivery-integration-testing/pom.xml
index af045db73c..50c001c1a9 100644
--- a/server/mailet/remote-delivery-integration-testing/pom.xml
+++ b/server/mailet/remote-delivery-integration-testing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailrepository/mailrepository-api/pom.xml b/server/mailrepository/mailrepository-api/pom.xml
index 59eb61967f..e89663fd7b 100644
--- a/server/mailrepository/mailrepository-api/pom.xml
+++ b/server/mailrepository/mailrepository-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailrepository/mailrepository-blob/pom.xml b/server/mailrepository/mailrepository-blob/pom.xml
index e625a6b2ad..6ca6d61f2c 100644
--- a/server/mailrepository/mailrepository-blob/pom.xml
+++ b/server/mailrepository/mailrepository-blob/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailrepository/mailrepository-cassandra/pom.xml b/server/mailrepository/mailrepository-cassandra/pom.xml
index d80d3fac82..e130d754ea 100644
--- a/server/mailrepository/mailrepository-cassandra/pom.xml
+++ b/server/mailrepository/mailrepository-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/mailrepository/mailrepository-memory/pom.xml b/server/mailrepository/mailrepository-memory/pom.xml
index 5cd199dfd2..b4dc56809d 100644
--- a/server/mailrepository/mailrepository-memory/pom.xml
+++ b/server/mailrepository/mailrepository-memory/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/pom.xml b/server/pom.xml
index 9108d104e0..e620ea751c 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>james-server</artifactId>
diff --git a/server/protocols/fetchmail/pom.xml b/server/protocols/fetchmail/pom.xml
index c52c82bc08..860b64313f 100644
--- a/server/protocols/fetchmail/pom.xml
+++ b/server/protocols/fetchmail/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/pom.xml b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/pom.xml
index b940e1224e..8e03b61be5 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/pom.xml
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-draft-integration-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-draft-integration-testing/memory-jmap-draft-integration-testing/pom.xml b/server/protocols/jmap-draft-integration-testing/memory-jmap-draft-integration-testing/pom.xml
index 70eebffe9f..d6e11bec10 100644
--- a/server/protocols/jmap-draft-integration-testing/memory-jmap-draft-integration-testing/pom.xml
+++ b/server/protocols/jmap-draft-integration-testing/memory-jmap-draft-integration-testing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-draft-integration-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-draft-integration-testing/pom.xml b/server/protocols/jmap-draft-integration-testing/pom.xml
index 6de5af5cc5..03da352bdb 100644
--- a/server/protocols/jmap-draft-integration-testing/pom.xml
+++ b/server/protocols/jmap-draft-integration-testing/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/pom.xml b/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/pom.xml
index c1bb6502c2..f5de905b33 100644
--- a/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/pom.xml
+++ b/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/pom.xml
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-draft-integration-testing</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-draft/pom.xml b/server/protocols/jmap-draft/pom.xml
index e912f442f3..91f360f8c0 100644
--- a/server/protocols/jmap-draft/pom.xml
+++ b/server/protocols/jmap-draft/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/pom.xml b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/pom.xml
index f7f74e3bbd..6f199cf2f8 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/pom.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-rfc-8621-integration-tests</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>distributed-jmap-rfc-8621-integration-tests</artifactId>
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/pom.xml b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/pom.xml
index e993e2d58c..6354333164 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/pom.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-rfc-8621-integration-tests</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
     <artifactId>jmap-rfc-8621-integration-tests-common</artifactId>
     <name>Apache James :: Server :: JMAP RFC-8621 :: Contract for Integration Testing</name>
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/pom.xml b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/pom.xml
index 51661bd7a3..8142553f92 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/pom.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>jmap-rfc-8621-integration-tests</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
     <artifactId>memory-jmap-rfc-8621-integration-tests</artifactId>
     <name>Apache James :: Server :: JMAP RFC-8621 :: Memory Integration Testing</name>
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/pom.xml b/server/protocols/jmap-rfc-8621-integration-tests/pom.xml
index af83e49a47..eb35f83d88 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/pom.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
     <artifactId>jmap-rfc-8621-integration-tests</artifactId>
diff --git a/server/protocols/jmap-rfc-8621/pom.xml b/server/protocols/jmap-rfc-8621/pom.xml
index 010911351a..cdaf00fc5f 100644
--- a/server/protocols/jmap-rfc-8621/pom.xml
+++ b/server/protocols/jmap-rfc-8621/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jmap/pom.xml b/server/protocols/jmap/pom.xml
index c7685a5b75..c20b53386c 100644
--- a/server/protocols/jmap/pom.xml
+++ b/server/protocols/jmap/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/jwt/pom.xml b/server/protocols/jwt/pom.xml
index a854203900..4c8c57b863 100644
--- a/server/protocols/jwt/pom.xml
+++ b/server/protocols/jwt/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-imap4/pom.xml b/server/protocols/protocols-imap4/pom.xml
index 78e36c2056..611d05e2ba 100644
--- a/server/protocols/protocols-imap4/pom.xml
+++ b/server/protocols/protocols-imap4/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-library/pom.xml b/server/protocols/protocols-library/pom.xml
index 7391b0b025..ffda3f0739 100644
--- a/server/protocols/protocols-library/pom.xml
+++ b/server/protocols/protocols-library/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-lmtp/pom.xml b/server/protocols/protocols-lmtp/pom.xml
index 26754255b4..a96f450d61 100644
--- a/server/protocols/protocols-lmtp/pom.xml
+++ b/server/protocols/protocols-lmtp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-managesieve/pom.xml b/server/protocols/protocols-managesieve/pom.xml
index 9e428c1ff1..30ecd5d919 100644
--- a/server/protocols/protocols-managesieve/pom.xml
+++ b/server/protocols/protocols-managesieve/pom.xml
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-pop3-distributed/pom.xml b/server/protocols/protocols-pop3-distributed/pom.xml
index 73c2674122..673c701a79 100644
--- a/server/protocols/protocols-pop3-distributed/pom.xml
+++ b/server/protocols/protocols-pop3-distributed/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-pop3/pom.xml b/server/protocols/protocols-pop3/pom.xml
index 3ac566bbe7..40b8bd64b1 100644
--- a/server/protocols/protocols-pop3/pom.xml
+++ b/server/protocols/protocols-pop3/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/protocols-smtp/pom.xml b/server/protocols/protocols-smtp/pom.xml
index 5ad9ab35f2..1949e326d5 100644
--- a/server/protocols/protocols-smtp/pom.xml
+++ b/server/protocols/protocols-smtp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/pom.xml
index 4ba48ce6e8..640bbb644e 100644
--- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>webadmin-integration-test</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/pom.xml
index b27ca47a72..cecfb594d3 100644
--- a/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>webadmin-integration-test</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/pom.xml
index c09dd685aa..4f23795202 100644
--- a/server/protocols/webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/pom.xml b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/pom.xml
index a35c475490..ea2c00f81c 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/pom.xml
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>webadmin-integration-test</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/pom.xml b/server/protocols/webadmin/pom.xml
index 4a3c7fd760..1cb51e1bc8 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-cassandra-data/pom.xml b/server/protocols/webadmin/webadmin-cassandra-data/pom.xml
index c8fa0e5623..174990ec8d 100644
--- a/server/protocols/webadmin/webadmin-cassandra-data/pom.xml
+++ b/server/protocols/webadmin/webadmin-cassandra-data/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-cassandra/pom.xml b/server/protocols/webadmin/webadmin-cassandra/pom.xml
index 7c64aba796..faf98f0528 100644
--- a/server/protocols/webadmin/webadmin-cassandra/pom.xml
+++ b/server/protocols/webadmin/webadmin-cassandra/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-core/pom.xml b/server/protocols/webadmin/webadmin-core/pom.xml
index 980501c79b..64f70d42a5 100644
--- a/server/protocols/webadmin/webadmin-core/pom.xml
+++ b/server/protocols/webadmin/webadmin-core/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-data/pom.xml b/server/protocols/webadmin/webadmin-data/pom.xml
index 12edf0f8d6..f2b43b8197 100644
--- a/server/protocols/webadmin/webadmin-data/pom.xml
+++ b/server/protocols/webadmin/webadmin-data/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-dropwizard-metrics/pom.xml b/server/protocols/webadmin/webadmin-dropwizard-metrics/pom.xml
index 6d3a0b790e..d7a2e2fba6 100644
--- a/server/protocols/webadmin/webadmin-dropwizard-metrics/pom.xml
+++ b/server/protocols/webadmin/webadmin-dropwizard-metrics/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-http-client/pom.xml b/server/protocols/webadmin/webadmin-http-client/pom.xml
index 3451f6425b..37668a79d9 100644
--- a/server/protocols/webadmin/webadmin-http-client/pom.xml
+++ b/server/protocols/webadmin/webadmin-http-client/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-jmap/pom.xml b/server/protocols/webadmin/webadmin-jmap/pom.xml
index 6aea209b24..e8924308e7 100644
--- a/server/protocols/webadmin/webadmin-jmap/pom.xml
+++ b/server/protocols/webadmin/webadmin-jmap/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/pom.xml b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
index 1491960b66..d8de5f5e72 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
+++ b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
index 7a0adf5e65..913d26f745 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-mailbox/pom.xml b/server/protocols/webadmin/webadmin-mailbox/pom.xml
index 6251fd8c91..d471d8c273 100644
--- a/server/protocols/webadmin/webadmin-mailbox/pom.xml
+++ b/server/protocols/webadmin/webadmin-mailbox/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-mailqueue/pom.xml b/server/protocols/webadmin/webadmin-mailqueue/pom.xml
index 9c67f6a0f1..d4bc93cf84 100644
--- a/server/protocols/webadmin/webadmin-mailqueue/pom.xml
+++ b/server/protocols/webadmin/webadmin-mailqueue/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-mailrepository/pom.xml b/server/protocols/webadmin/webadmin-mailrepository/pom.xml
index 15d8dc5b6a..4917130243 100644
--- a/server/protocols/webadmin/webadmin-mailrepository/pom.xml
+++ b/server/protocols/webadmin/webadmin-mailrepository/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-pop3/pom.xml b/server/protocols/webadmin/webadmin-pop3/pom.xml
index 5144583891..8c4d063a63 100644
--- a/server/protocols/webadmin/webadmin-pop3/pom.xml
+++ b/server/protocols/webadmin/webadmin-pop3/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/protocols/webadmin/webadmin-rabbitmq/pom.xml b/server/protocols/webadmin/webadmin-rabbitmq/pom.xml
index 4d636dbf71..3d435db689 100644
--- a/server/protocols/webadmin/webadmin-rabbitmq/pom.xml
+++ b/server/protocols/webadmin/webadmin-rabbitmq/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-activemq/pom.xml b/server/queue/queue-activemq/pom.xml
index f7d1dca813..6deebbd0da 100644
--- a/server/queue/queue-activemq/pom.xml
+++ b/server/queue/queue-activemq/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-api/pom.xml b/server/queue/queue-api/pom.xml
index 4344c9b5e2..211c16835e 100644
--- a/server/queue/queue-api/pom.xml
+++ b/server/queue/queue-api/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-jms/pom.xml b/server/queue/queue-jms/pom.xml
index 1b446a7a80..2d544c8291 100644
--- a/server/queue/queue-jms/pom.xml
+++ b/server/queue/queue-jms/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-memory/pom.xml b/server/queue/queue-memory/pom.xml
index 5cee79ecc4..e3bc274477 100644
--- a/server/queue/queue-memory/pom.xml
+++ b/server/queue/queue-memory/pom.xml
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-pulsar/pom.xml b/server/queue/queue-pulsar/pom.xml
index 1646163601..22b1045b9a 100644
--- a/server/queue/queue-pulsar/pom.xml
+++ b/server/queue/queue-pulsar/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/queue/queue-rabbitmq/pom.xml b/server/queue/queue-rabbitmq/pom.xml
index 2dc868477a..a7b74e16a9 100644
--- a/server/queue/queue-rabbitmq/pom.xml
+++ b/server/queue/queue-rabbitmq/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/task/task-api/pom.xml b/server/task/task-api/pom.xml
index 0d94e6299c..7549da203c 100644
--- a/server/task/task-api/pom.xml
+++ b/server/task/task-api/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/task/task-distributed/pom.xml b/server/task/task-distributed/pom.xml
index 302d96a6fc..a519d46daf 100644
--- a/server/task/task-distributed/pom.xml
+++ b/server/task/task-distributed/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/task/task-json/pom.xml b/server/task/task-json/pom.xml
index f2918b1873..09acfe00e4 100644
--- a/server/task/task-json/pom.xml
+++ b/server/task/task-json/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/task/task-memory/pom.xml b/server/task/task-memory/pom.xml
index 499c66dea7..0568ee8049 100644
--- a/server/task/task-memory/pom.xml
+++ b/server/task/task-memory/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/server/testing/pom.xml b/server/testing/pom.xml
index b9e5817d21..bf4f1223fc 100644
--- a/server/testing/pom.xml
+++ b/server/testing/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/testing/base/pom.xml b/testing/base/pom.xml
index 59090cf651..08b4598df0 100644
--- a/testing/base/pom.xml
+++ b/testing/base/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
diff --git a/third-party/clamav/pom.xml b/third-party/clamav/pom.xml
index d5c75f59bd..204aba08e4 100644
--- a/third-party/clamav/pom.xml
+++ b/third-party/clamav/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>third-party</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-clamav</artifactId>
diff --git a/third-party/elasticsearch/pom.xml b/third-party/elasticsearch/pom.xml
index b0c80d4f0b..d66f380c20 100644
--- a/third-party/elasticsearch/pom.xml
+++ b/third-party/elasticsearch/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>third-party</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-elasticsearch</artifactId>
diff --git a/third-party/linshare/pom.xml b/third-party/linshare/pom.xml
index d6d84ecbd9..bdb6981787 100644
--- a/third-party/linshare/pom.xml
+++ b/third-party/linshare/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>third-party</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-linshare</artifactId>
diff --git a/third-party/pom.xml b/third-party/pom.xml
index a5fc3d8513..2a4138828e 100644
--- a/third-party/pom.xml
+++ b/third-party/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>james-project</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>third-party</artifactId>
diff --git a/third-party/rspamd/pom.xml b/third-party/rspamd/pom.xml
index d04477d4da..b754253344 100644
--- a/third-party/rspamd/pom.xml
+++ b/third-party/rspamd/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>third-party</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-rspamd</artifactId>
diff --git a/third-party/spamassassin/pom.xml b/third-party/spamassassin/pom.xml
index 8a948fab3d..12a326e92d 100644
--- a/third-party/spamassassin/pom.xml
+++ b/third-party/spamassassin/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james</groupId>
         <artifactId>third-party</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>apache-james-spamassassin</artifactId>


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


[james-project] 22/28: JAMES-3914 Sieve Vacation: support several recipients

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 437cae047ea820b6230cc55f85d7dd98b8bc3cf5
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 15:08:31 2023 +0700

    JAMES-3914 Sieve Vacation: support several recipients
---
 .../transport/mailets/jsieve/ActionUtils.java      |  5 ++---
 .../transport/mailets/jsieve/RedirectAction.java   |  2 +-
 .../transport/mailets/jsieve/RejectAction.java     |  2 +-
 .../transport/mailets/jsieve/VacationReply.java    |  2 +-
 .../mailets/delivery/SieveIntegrationTest.java     | 22 ++++++++++++++++++++++
 5 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
index c013e92906..94884c1261 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
@@ -59,9 +59,8 @@ public class ActionUtils {
      * Detect and handle locally looping mail. External loop detection is left
      * to the MTA.
      */
-    public static void detectAndHandleLocalLooping(Mail aMail, String anAttributeSuffix)
-            throws MessagingException {
-        MailAddress thisRecipient = getSoleRecipient(aMail);
+    public static void detectAndHandleLocalLooping(Mail aMail, ActionContext context, String anAttributeSuffix) {
+        MailAddress thisRecipient = context.getRecipient();
         AttributeName attributeName = AttributeName.of(ATTRIBUTE_PREFIX + anAttributeSuffix);
         AttributeUtils
             .getValueAndCastFromMail(aMail, attributeName, String.class)
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java
index 83773d236f..ec9c6d4de1 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java
@@ -56,7 +56,7 @@ public class RedirectAction implements MailAction {
      * @throws MessagingException
      */
     public void execute(ActionRedirect anAction, Mail aMail, ActionContext context) throws MessagingException {
-        ActionUtils.detectAndHandleLocalLooping(aMail, "redirect");
+        ActionUtils.detectAndHandleLocalLooping(aMail, context, "redirect");
 
         MailImpl redirectedMail = MailImpl.builder()
             .name("redirect-" + aMail.getName())
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
index a35ebc6270..b9a81a57f2 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
@@ -81,7 +81,7 @@ public class RejectAction implements MailAction {
      * @throws MessagingException
      */
     public void execute(ActionReject anAction, Mail aMail, ActionContext context) throws MessagingException {
-        ActionUtils.detectAndHandleLocalLooping(aMail, "reject");
+        ActionUtils.detectAndHandleLocalLooping(aMail, context, "reject");
 
         // Create the MDN part
         StringBuilder humanText = new StringBuilder(128);
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java
index 5caf2f40bd..8845fdc1cf 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java
@@ -81,7 +81,7 @@ public class VacationReply {
 
         public VacationReply build() throws MessagingException {
             Preconditions.checkState(eitherReasonOrMime());
-            ActionUtils.detectAndHandleLocalLooping(originalMail, "vacation");
+            ActionUtils.detectAndHandleLocalLooping(originalMail,  context, "vacation");
 
             MimeMessage reply = (MimeMessage) originalMail.getMessage().reply(false);
             reply.setSubject(generateNotificationSubject());
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 029ccaf8b9..2b7bd165ae 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -156,6 +156,8 @@ class SieveIntegrationTest {
         assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX_ANY);
     }
 
+
+    // ANCHOR
     @Test
     void shouldSupportSeveralRecipientsWhenFileInto() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/fileinto.script");
@@ -846,6 +848,26 @@ class SieveIntegrationTest {
         assertThat(fakeMailContext.getSentMails()).containsExactly(expectedSentMail);
     }
 
+    @Test
+    void vacationShouldWorkWhenSeveralRecipients() throws Exception {
+        prepareTestUsingScript("org/apache/james/transport/mailets/delivery/vacationReason.script");
+        when(usersRepository.getUsername(new MailAddress("other@domain.tld"))).thenReturn(Username.of("other@domain.tld"));
+        when(resourceLocator.get(new MailAddress("other@domain.tld"))).thenThrow(new ScriptNotFoundException());
+
+        FakeMail mail = createMail();
+        mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
+        testee.service(mail);
+
+        assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX);
+
+        FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
+            .sender(new MailAddress(RECEIVER_DOMAIN_COM))
+            .recipient(new MailAddress("sender@any.com"))
+            .fromMailet()
+            .build();
+        assertThat(fakeMailContext.getSentMails()).containsExactly(expectedSentMail);
+    }
+
     @Test
     void vacationShouldNotSendNotificationToMailingLists() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/vacationReason.script");


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


[james-project] 07/28: JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 5766ed851042450a333fe9b266b7d4acbb91e467
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Fri Jun 9 13:52:07 2023 +0700

    JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583)
    
    Avoids loading all mail metadata
---
 .../apache/james/mailbox/jpa/mail/JPAMessageMapper.java | 17 +++++++++++++++--
 .../mail/model/openjpa/AbstractJPAMailboxMessage.java   |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
index 39fba12976..c9a05f7cc9 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
@@ -59,6 +59,8 @@ import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.ImmutableList;
 
 import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * JPA implementation of a {@link MessageMapper}. This class is not thread-safe!
@@ -89,8 +91,17 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
 
     @Override
     public Flux<MessageUid> listAllMessageUids(Mailbox mailbox) {
-        return findInMailboxReactive(mailbox, MessageRange.all(), FetchType.METADATA, UNLIMITED)
-            .map(MailboxMessage::getUid);
+        return Mono.fromCallable(() -> {
+            try {
+                JPAId mailboxId = (JPAId) mailbox.getMailboxId();
+                Query query = getEntityManager().createNamedQuery("listUidsInMailbox")
+                    .setParameter("idParam", mailboxId.getRawId());
+                return query.getResultStream().map(result -> MessageUid.of((Long) result));
+            } catch (PersistenceException e) {
+                throw new MailboxException("Search of recent messages failed in mailbox " + mailbox, e);
+            }
+        }).flatMapMany(Flux::fromStream)
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     @Override
@@ -208,6 +219,8 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
         }
     }
 
+
+
     @Override
     public List<MessageUid> retrieveMessagesMarkedForDeletion(Mailbox mailbox, MessageRange messageRange) throws MailboxException {
         try {
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
index 2b9887f18b..6de70c6d8c 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
@@ -80,6 +80,7 @@ import com.google.common.collect.ImmutableList;
 @IdClass(AbstractJPAMailboxMessage.MailboxIdUidKey.class)
 @NamedQueries({
         @NamedQuery(name = "findRecentMessageUidsInMailbox", query = "SELECT message.uid FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.recent = TRUE ORDER BY message.uid ASC"),
+        @NamedQuery(name = "listUidsInMailbox", query = "SELECT message.uid FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam ORDER BY message.uid ASC"),
         @NamedQuery(name = "findUnseenMessagesInMailboxOrderByUid", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.seen = FALSE ORDER BY message.uid ASC"),
         @NamedQuery(name = "findMessagesInMailbox", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam ORDER BY message.uid ASC"),
         @NamedQuery(name = "findMessagesInMailboxBetweenUIDs", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.uid BETWEEN :fromParam AND :toParam ORDER BY message.uid ASC"),


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


[james-project] 19/28: JAMES-3906 Documentation

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 50aff7b1890a31e91fe6aabdb51841e4c97381b5
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri May 26 09:37:09 2023 +0700

    JAMES-3906 Documentation
---
 .../AbstractSSLAwareChannelPipelineFactory.java    |  3 ++-
 .../docs/modules/ROOT/pages/operate/webadmin.adoc  | 23 ++++++++++++++++++++++
 src/site/markdown/server/manage-webadmin.md        | 23 ++++++++++++++++++++++
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
index dc7e4330a4..c04acb83f1 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
@@ -68,6 +68,7 @@ public abstract class AbstractSSLAwareChannelPipelineFactory<C extends SocketCha
      * Return if the socket is using SSL/TLS
      */
     protected boolean isSSLSocket() {
-        return secure != null && secure.get().supportsEncryption() && !secure.get().isStartTLS();
+        Encryption encryption = secure.get();
+        return encryption != null && encryption.supportsEncryption() && !encryption.isStartTLS();
     }
 }
diff --git a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc
index bf37c8343f..2449073d27 100644
--- a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc
+++ b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc
@@ -4819,3 +4819,26 @@ This is an example of returned body.
   "targetsContent": false
 }
 ....
+
+== Reloading server certificates
+
+Certificates for TCP based protocols (IMAP, SMTP, POP3, LMTP and ManageSieve) can be updated at
+runtime, without service interuption and without closing existing connections.
+
+In order to do so:
+
+ - Generate / retrieve your cryptographic materials and replace the ones specified in James configuration.
+ - Then call the following endpoint:
+
+....
+curl -XPOST http://ip:port/servers?reload-certificate
+....
+
+Optional query parameters:
+
+ - `port`: positive integer (valid port number). Only reload certificates for the specific port.
+
+Return code:
+
+ - 204: the certificate is reloaded
+ - 400: Invalid request.
\ No newline at end of file
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index 4f59df86d3..f091d3c0a3 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -4514,3 +4514,26 @@ Response codes :
 
  - 201: the taskId of the created task
  - 400: Invalid action argument for performing operation on mappings data
+
+## Reloading server certificates
+
+Certificates for TCP based protocols (IMAP, SMTP, POP3, LMTP and ManageSieve) can be updated at
+runtime, without service interuption and without closing existing connections.
+
+In order to do so:
+
+ - Generate / retrieve your cryptographic materials and replace the ones specified in James configuration.
+ - Then call the following endpoint:
+
+```
+curl -XPOST http://ip:port/servers?reload-certificate
+```
+
+Optional query parameters:
+
+ - `port`: positive integer (valid port number). Only reload certificates for the specific port.
+
+Return code:
+
+ - 204: the certificate is reloaded
+ - 400: Invalid request.
\ No newline at end of file


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


[james-project] 20/28: JAMES-3906 Use an interface dedicated for certificate reload in bindings

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit c283255d68b3e4c14a47a71eeeb33f822d86ff62
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue May 30 08:51:00 2023 +0700

    JAMES-3906 Use an interface dedicated for certificate reload in bindings
---
 .../java/org/apache/james/CertificateReloadTest.java  |  2 +-
 .../james/modules/protocols/IMAPServerModule.java     |  4 ++--
 .../james/modules/protocols/LMTPServerModule.java     |  4 ++--
 .../modules/protocols/ManageSieveServerModule.java    |  4 ++--
 .../james/modules/protocols/POP3ServerModule.java     |  4 ++--
 .../james/modules/protocols/SMTPServerModule.java     |  4 ++--
 .../james/modules/protocols/SmtpGuiceProbe.java       |  5 +----
 .../protocols/lib/netty/AbstractServerFactory.java    | 10 ++++++++--
 .../protocols/lib/netty/CertificateReloadable.java    |  7 +++++++
 .../protocols/webadmin/ProtocolServerRoutes.java      | 19 +++++++++----------
 10 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
index 8de9a48892..7b084f45d7 100644
--- a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
+++ b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
@@ -203,7 +203,7 @@ class CertificateReloadTest {
         .then()
             .statusCode(204);
 
-        System.out.println(readBytes(channel));
+        readBytes(channel);
         channel.getOutputStream().write("EHLO toto.com\r\n".getBytes(StandardCharsets.UTF_8));
         assertThat(readBytes(channel))
             .contains("250 8BITMIME");
diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
index 603fdc7a15..fa478b0b6a 100644
--- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
+++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
@@ -60,7 +60,7 @@ import org.apache.james.imapserver.netty.IMAPServerFactory;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.metrics.api.GaugeRegistry;
 import org.apache.james.metrics.api.MetricFactory;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.utils.ClassName;
 import org.apache.james.utils.GuiceGenericLoader;
@@ -101,7 +101,7 @@ public class IMAPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(IMAPServerFactory.class);
+        Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(IMAPServerFactory.class);
     }
 
     @Provides
diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
index 9e198cf843..e16e9cf945 100644
--- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
+++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
@@ -24,7 +24,7 @@ import org.apache.james.RunArguments;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.lmtpserver.netty.LMTPServerFactory;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
@@ -44,7 +44,7 @@ public class LMTPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(LmtpGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(LMTPServerFactory.class);
+        Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(LMTPServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
index 9f62812d45..8eb469d48a 100644
--- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -25,7 +25,7 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.managesieve.api.commands.CoreCommands;
 import org.apache.james.managesieve.core.CoreProcessor;
 import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
@@ -47,7 +47,7 @@ public class ManageSieveServerModule extends AbstractModule {
         bind(CoreCommands.class).to(CoreProcessor.class);
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class);
 
-        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(ManageSieveServerFactory.class);
+        Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(ManageSieveServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
index 75bfc62949..445fb50b03 100644
--- a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
+++ b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
@@ -26,7 +26,7 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.pop3server.mailbox.DefaultMailboxAdapterFactory;
 import org.apache.james.pop3server.mailbox.MailboxAdapterFactory;
 import org.apache.james.pop3server.netty.POP3ServerFactory;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
@@ -48,7 +48,7 @@ public class POP3ServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(Pop3GuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(POP3ServerFactory.class);
+        Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(POP3ServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
index b3b8dcd3b2..b4f6b08e3c 100644
--- a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
@@ -23,7 +23,7 @@ import org.apache.james.ProtocolConfigurationSanitizer;
 import org.apache.james.RunArguments;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.smtpserver.SendMailHandler;
 import org.apache.james.smtpserver.netty.SMTPServerFactory;
@@ -45,7 +45,7 @@ public class SMTPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SmtpGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(SMTPServerFactory.class);
+        Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(SMTPServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
index ed07df2af4..42815e52b3 100644
--- a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
@@ -65,10 +65,7 @@ public class SmtpGuiceProbe implements GuiceProbe {
     }
 
     public Port getSmtpSslPort() {
-        return getPort(server -> {
-            System.out.println(server.getServiceType());
-            return server.getSocketType().equals("secure");
-        });
+        return getPort(server -> server.getSocketType().equals("secure"));
     }
 
     public Port getSmtpAuthRequiredPort() {
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
index bf672d5efa..62fccd9ecd 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java
@@ -20,6 +20,7 @@
 package org.apache.james.protocols.lib.netty;
 
 import java.util.List;
+import java.util.stream.Stream;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -31,7 +32,7 @@ import org.apache.james.lifecycle.api.Configurable;
 /**
  * Abstract base class for Factories that need to create {@link AbstractConfigurableAsyncServer}'s via configuration files
  */
-public abstract class AbstractServerFactory implements Configurable {
+public abstract class AbstractServerFactory implements Configurable, CertificateReloadable.Factory {
 
     private List<AbstractConfigurableAsyncServer> servers;
     private HierarchicalConfiguration<ImmutableNode> config;
@@ -69,5 +70,10 @@ public abstract class AbstractServerFactory implements Configurable {
             server.destroy();
         }
     }
- 
+
+    @Override
+    public Stream<AbstractConfigurableAsyncServer> certificatesReloadable() {
+        return getServers().stream()
+            .filter(AbstractConfigurableAsyncServer::isEnabled);
+    }
 }
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
index 248de22857..79656203f5 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
@@ -18,7 +18,14 @@
  ****************************************************************/
 package org.apache.james.protocols.lib.netty;
 
+import java.util.stream.Stream;
+
 public interface CertificateReloadable {
+    interface Factory {
+        Stream<? extends CertificateReloadable> certificatesReloadable();
+    }
 
     void reloadSSLCertificate() throws Exception;
+
+    int getPort();
 }
diff --git a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
index 028b75f3e1..d78109e518 100644
--- a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
+++ b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
@@ -24,8 +24,7 @@ import java.util.Set;
 
 import javax.inject.Inject;
 
-import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.lib.netty.CertificateReloadable;
 import org.apache.james.util.Port;
 import org.apache.james.webadmin.Routes;
 import org.apache.james.webadmin.utils.ErrorResponder;
@@ -42,10 +41,10 @@ import spark.Service;
 public class ProtocolServerRoutes implements Routes {
     public static final String SERVERS = "servers";
 
-    private final Set<AbstractServerFactory> servers;
+    private final Set<CertificateReloadable.Factory> servers;
 
     @Inject
-    public ProtocolServerRoutes(Set<AbstractServerFactory> servers) {
+    public ProtocolServerRoutes(Set<CertificateReloadable.Factory> servers) {
         this.servers = servers;
     }
 
@@ -69,16 +68,15 @@ public class ProtocolServerRoutes implements Routes {
             }
 
             servers.stream()
-                .flatMap(serverFactory -> serverFactory.getServers().stream())
-                .filter(AbstractConfigurableAsyncServer::isEnabled)
+                .flatMap(CertificateReloadable.Factory::certificatesReloadable)
                 .filter(filters(request))
-                .forEach(Throwing.consumer(AbstractConfigurableAsyncServer::reloadSSLCertificate));
+                .forEach(Throwing.consumer(CertificateReloadable::reloadSSLCertificate));
 
             return Responses.returnNoContent(response);
         });
     }
 
-    private Predicate<AbstractConfigurableAsyncServer> filters(Request request) {
+    private Predicate<CertificateReloadable> filters(Request request) {
         Optional<Port> port = Optional.ofNullable(request.queryParams("port")).map(Integer::parseUnsignedInt).map(Port::of);
 
         return server -> port.map(p -> server.getPort() == p.getValue()).orElse(true);
@@ -86,7 +84,8 @@ public class ProtocolServerRoutes implements Routes {
 
     private boolean noServerEnabled() {
         return servers.stream()
-            .flatMap(serverFactory -> serverFactory.getServers().stream())
-            .filter(AbstractConfigurableAsyncServer::isEnabled).findFirst().isEmpty();
+            .flatMap(CertificateReloadable.Factory::certificatesReloadable)
+            .findFirst()
+            .isEmpty();
     }
 }


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


[james-project] 05/28: [FIX] JPA: avoid leaks in entity manager

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit bb9cebc6c5ee0f026a31ce65decf25633058940a
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jun 2 17:07:37 2023 +0700

    [FIX] JPA: avoid leaks in entity manager
---
 .../listeners/SetCustomFlagOnBigMessages.java      |  1 +
 .../james/mailbox/backup/DefaultMailboxBackup.java | 16 +++++----
 .../mailbox/backup/ZipMailArchiveRestorer.java     |  1 +
 .../CassandraMailboxSessionMapperFactory.java      |  5 +++
 ...CassandraRecomputeCurrentQuotasServiceTest.java |  2 +-
 .../task/JPARecomputeCurrentQuotasServiceTest.java |  2 +-
 .../MemoryRecomputeCurrentQuotasServiceTest.java   |  4 ++-
 .../mailbox/store/SystemMailboxesProviderImpl.java |  3 +-
 .../store/event/MailboxAnnotationListener.java     |  3 +-
 .../store/quota/DefaultUserQuotaRootResolver.java  |  6 ++--
 .../store/search/ListeningMessageSearchIndex.java  |  6 ++--
 .../store/event/MailboxAnnotationListenerTest.java |  3 ++
 .../mailbox/tools/indexer/ReIndexerImpl.java       |  1 +
 .../mailbox/tools/indexer/ReIndexerPerformer.java  | 18 ++++++----
 .../quota/task/RecomputeCurrentQuotasService.java  |  9 +++--
 .../james/healthcheck/MailReceptionCheck.java      |  3 +-
 .../adapter/mailbox/ACLUsernameChangeTaskStep.java |  7 ++--
 .../mailbox/MailboxUsernameChangeTaskStep.java     | 16 ++++++---
 .../james/transport/mailets/RandomStoring.java     |  3 +-
 .../jmap/draft/send/PostDequeueDecorator.java      |  1 +
 .../james/jmap/mailet/filter/ActionApplier.java    |  1 +
 .../webadmin/vault/routes/RestoreService.java      |  3 +-
 .../webadmin/service/CreateMissingParentsTask.java | 15 ++++----
 .../webadmin/service/ExpireMailboxService.java     |  3 +-
 .../webadmin/service/UserMailboxesService.java     | 41 ++++++++++++++++------
 .../org/apache/james/rspamd/RspamdListener.java    | 10 ++++--
 .../rspamd/task/GetMailboxMessagesService.java     |  6 ++--
 .../james/spamassassin/SpamAssassinListener.java   |  2 ++
 28 files changed, 135 insertions(+), 56 deletions(-)

diff --git a/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java b/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java
index d7223c1d6b..192e6df1a0 100644
--- a/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java
+++ b/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java
@@ -86,6 +86,7 @@ class SetCustomFlagOnBigMessages implements EventListener.GroupEventListener {
                 FlagsUpdateMode.ADD,
                 MessageRange.one(messageUid),
                 session);
+            mailboxManager.endProcessingRequest(session);
         } catch (MailboxException e) {
             LOGGER.error("error happens when adding '{}' flag to the message with uid {} in mailbox {} of user {}",
                 BIG_MESSAGE, messageUid.asLong(), addedEvent.getMailboxId(), addedEvent.getUsername().asString(), e);
diff --git a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java
index 0c9fd32bcd..bc6697a88a 100644
--- a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java
+++ b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java
@@ -32,7 +32,6 @@ import org.apache.james.core.Username;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.exception.BadCredentialsException;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.FetchGroup;
 import org.apache.james.mailbox.model.Mailbox;
@@ -98,14 +97,19 @@ public class DefaultMailboxBackup implements MailboxBackup {
 
         Stream<MessageResult> messages = allMessagesForUser(accountContents);
         archive(mailboxes, messages, destination);
+        mailboxManager.endProcessingRequest(session);
     }
 
-    private boolean isAccountNonEmpty(Username username) throws BadCredentialsException, MailboxException, IOException {
+    private boolean isAccountNonEmpty(Username username) throws MailboxException {
         MailboxSession session = mailboxManager.createSystemSession(username);
-        return getAccountContentForUser(session)
-            .stream()
-            .findFirst()
-            .isPresent();
+        try {
+            return getAccountContentForUser(session)
+                .stream()
+                .findFirst()
+                .isPresent();
+        } finally {
+            mailboxManager.endProcessingRequest(session);
+        }
     }
 
     @Override
diff --git a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/ZipMailArchiveRestorer.java b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/ZipMailArchiveRestorer.java
index 5830c69019..215f7b19bf 100644
--- a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/ZipMailArchiveRestorer.java
+++ b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/ZipMailArchiveRestorer.java
@@ -58,6 +58,7 @@ public class ZipMailArchiveRestorer implements MailArchiveRestorer {
     public void restore(Username username, InputStream source) throws MailboxException, IOException {
         MailboxSession session = mailboxManager.createSystemSession(username);
         restoreEntries(source, session);
+        mailboxManager.endProcessingRequest(session);
     }
 
     private void restoreEntries(InputStream source, MailboxSession session) throws IOException {
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
index 84d86b1882..fb3069869b 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
@@ -231,6 +231,11 @@ public class CassandraMailboxSessionMapperFactory extends MailboxSessionMapperFa
         return cassandraSubscriptionMapper;
     }
 
+    @Override
+    public void endProcessingRequest(MailboxSession session) {
+
+    }
+
     public DeleteMessageListener deleteMessageListener() {
         return new DeleteMessageListener(threadDAO, threadLookupDAO, imapUidDAO, messageIdDAO, messageDAO, messageDAOV3, attachmentDAOV2,
             attachmentMessageIdDAO, aclMapper, userMailboxRightsDAO, applicableFlagDAO, firstUnseenDAO, deletedMessageDAO,
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/task/CassandraRecomputeCurrentQuotasServiceTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/task/CassandraRecomputeCurrentQuotasServiceTest.java
index 113b741ed4..9b5d3b628a 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/task/CassandraRecomputeCurrentQuotasServiceTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/task/CassandraRecomputeCurrentQuotasServiceTest.java
@@ -86,7 +86,7 @@ public class CassandraRecomputeCurrentQuotasServiceTest implements RecomputeCurr
         userQuotaRootResolver = new DefaultUserQuotaRootResolver(sessionProvider, mapperFactory);
         CurrentQuotaCalculator currentQuotaCalculator = new CurrentQuotaCalculator(mapperFactory, userQuotaRootResolver);
 
-        testee = new RecomputeCurrentQuotasService(usersRepository, currentQuotaManager, currentQuotaCalculator, userQuotaRootResolver, sessionProvider);
+        testee = new RecomputeCurrentQuotasService(usersRepository, currentQuotaManager, currentQuotaCalculator, userQuotaRootResolver, sessionProvider, mailboxManager);
     }
 
     @Override
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/task/JPARecomputeCurrentQuotasServiceTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/task/JPARecomputeCurrentQuotasServiceTest.java
index 5d5dfbf696..43925070a6 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/task/JPARecomputeCurrentQuotasServiceTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/task/JPARecomputeCurrentQuotasServiceTest.java
@@ -87,7 +87,7 @@ class JPARecomputeCurrentQuotasServiceTest implements RecomputeCurrentQuotasServ
 
         CurrentQuotaCalculator currentQuotaCalculator = new CurrentQuotaCalculator(mapperFactory, userQuotaRootResolver);
 
-        testee = new RecomputeCurrentQuotasService(usersRepository, currentQuotaManager, currentQuotaCalculator, userQuotaRootResolver, sessionProvider);
+        testee = new RecomputeCurrentQuotasService(usersRepository, currentQuotaManager, currentQuotaCalculator, userQuotaRootResolver, sessionProvider, mailboxManager);
     }
 
     @AfterEach
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/task/MemoryRecomputeCurrentQuotasServiceTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/task/MemoryRecomputeCurrentQuotasServiceTest.java
index 328fccb798..2fa06bde62 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/task/MemoryRecomputeCurrentQuotasServiceTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/task/MemoryRecomputeCurrentQuotasServiceTest.java
@@ -26,6 +26,7 @@ import org.apache.james.domainlist.lib.DomainListConfiguration;
 import org.apache.james.domainlist.memory.MemoryDomainList;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.SessionProvider;
+import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.quota.CurrentQuotaManager;
 import org.apache.james.mailbox.quota.UserQuotaRootResolver;
@@ -52,7 +53,8 @@ class MemoryRecomputeCurrentQuotasServiceTest implements RecomputeCurrentQuotasS
         usersRepository = MemoryUsersRepository.withoutVirtualHosting(memoryDomainList);
 
         resources = InMemoryIntegrationResources.defaultResources();
-        testee = new RecomputeCurrentQuotasService(usersRepository, resources.getCurrentQuotaManager(), resources.getCurrentQuotaCalculator(), resources.getDefaultUserQuotaRootResolver(), resources.getMailboxManager().getSessionProvider());
+        InMemoryMailboxManager mailboxManager = resources.getMailboxManager();
+        testee = new RecomputeCurrentQuotasService(usersRepository, resources.getCurrentQuotaManager(), resources.getCurrentQuotaCalculator(), resources.getDefaultUserQuotaRootResolver(), mailboxManager.getSessionProvider(), mailboxManager);
     }
 
     @Override
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SystemMailboxesProviderImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SystemMailboxesProviderImpl.java
index 3b6a2fbd7c..a1518902b1 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SystemMailboxesProviderImpl.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SystemMailboxesProviderImpl.java
@@ -57,7 +57,8 @@ public class SystemMailboxesProviderImpl implements SystemMailboxesProvider {
 
         return Mono.from(mailboxManager.getMailboxReactive(mailboxPath, session))
             .flux()
-            .onErrorResume(MailboxNotFoundException.class, e -> searchMessageManagerByMailboxRole(aRole, username));
+            .onErrorResume(MailboxNotFoundException.class, e -> searchMessageManagerByMailboxRole(aRole, username))
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 
     private boolean hasRole(Role aRole, MailboxPath mailBoxPath) {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
index 6385f9caf2..8d11cb6ec9 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
@@ -69,7 +69,8 @@ public class MailboxAnnotationListener implements EventListener.ReactiveGroupEve
 
             return Flux.from(annotationMapper.getAllAnnotationsReactive(mailboxId))
                 .flatMap(annotation -> Mono.from(annotationMapper.deleteAnnotationReactive(mailboxId, annotation.getKey())))
-                .then();
+                .then()
+                .doFinally(any -> mailboxSessionMapperFactory.endProcessingRequest(mailboxSession));
         }
         return Mono.empty();
     }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultUserQuotaRootResolver.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultUserQuotaRootResolver.java
index 00506ca094..db58bf198f 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultUserQuotaRootResolver.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultUserQuotaRootResolver.java
@@ -121,7 +121,8 @@ public class DefaultUserQuotaRootResolver implements UserQuotaRootResolver {
         return factory.getMailboxMapper(session)
             .findMailboxById(mailboxId)
             .map(Mailbox::generateAssociatedPath)
-            .flatMap(path -> Mono.from(getQuotaRootReactive(path)));
+            .flatMap(path -> Mono.from(getQuotaRootReactive(path)))
+            .doFinally(any -> factory.endProcessingRequest(session));
     }
 
     @Override
@@ -138,7 +139,8 @@ public class DefaultUserQuotaRootResolver implements UserQuotaRootResolver {
             .flatMap(this::getQuotaRootReactive, ReactorUtils.DEFAULT_CONCURRENCY)
             .distinct();
 
-        return Flux.concat(quotaRootListFromDelegatedMailboxes, Flux.just(forUser(username)));
+        return Flux.concat(quotaRootListFromDelegatedMailboxes, Flux.just(forUser(username)))
+            .doFinally(any -> factory.endProcessingRequest(session));
     }
 
     @Override
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
index 3eb17a3661..5fb5019d56 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
@@ -95,9 +95,9 @@ public abstract class ListeningMessageSearchIndex implements MessageSearchIndex,
      */
     @Override
     public Mono<Void> reactiveEvent(Event event) {
-        return handleMailboxEvent(event,
-            sessionProvider.createSystemSession(event.getUsername()),
-            (MailboxEvent) event);
+        MailboxSession systemSession = sessionProvider.createSystemSession(event.getUsername());
+        return handleMailboxEvent(event, systemSession, (MailboxEvent) event)
+            .then(Mono.fromRunnable(() -> factory.endProcessingRequest(systemSession)));
     }
 
     private Mono<Void> handleMailboxEvent(Event event, MailboxSession session, MailboxEvent mailboxEvent) {
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
index 1c310a5447..19739fdac7 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
@@ -125,6 +125,7 @@ class MailboxAnnotationListenerTest {
         listener.event(deleteEvent);
 
         verify(mailboxSessionMapperFactory).getAnnotationMapper(eq(mailboxSession));
+        verify(mailboxSessionMapperFactory).endProcessingRequest(eq(mailboxSession));
         verify(annotationMapper).getAllAnnotationsReactive(eq(mailboxId));
 
         verifyNoMoreInteractions(mailboxSessionMapperFactory);
@@ -140,6 +141,7 @@ class MailboxAnnotationListenerTest {
         listener.event(deleteEvent);
 
         verify(mailboxSessionMapperFactory).getAnnotationMapper(eq(mailboxSession));
+        verify(mailboxSessionMapperFactory).endProcessingRequest(eq(mailboxSession));
         verify(annotationMapper).getAllAnnotationsReactive(eq(mailboxId));
         verify(annotationMapper).deleteAnnotationReactive(eq(mailboxId), eq(PRIVATE_KEY));
         verify(annotationMapper).deleteAnnotationReactive(eq(mailboxId), eq(SHARED_KEY));
@@ -158,6 +160,7 @@ class MailboxAnnotationListenerTest {
         assertThatThrownBy(() -> listener.event(deleteEvent)).isInstanceOf(RuntimeException.class);
 
         verify(mailboxSessionMapperFactory).getAnnotationMapper(eq(mailboxSession));
+        verify(mailboxSessionMapperFactory).endProcessingRequest(eq(mailboxSession));
         verify(annotationMapper).getAllAnnotationsReactive(eq(mailboxId));
         verify(annotationMapper).deleteAnnotationReactive(eq(mailboxId), eq(PRIVATE_KEY));
 
diff --git a/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerImpl.java b/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerImpl.java
index f557602cd1..d4adbfa34f 100644
--- a/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerImpl.java
+++ b/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerImpl.java
@@ -106,5 +106,6 @@ public class ReIndexerImpl implements ReIndexer {
     private void validateIdExists(MailboxId mailboxId) throws MailboxException {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(Username.of("ReIndexingImap"));
         MailboxReactorUtils.block(mapperFactory.getMailboxMapper(mailboxSession).findMailboxById(mailboxId));
+        mailboxManager.endProcessingRequest(mailboxSession);
     }
 }
diff --git a/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerPerformer.java b/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerPerformer.java
index eafd50fe2a..9a1d779bc1 100644
--- a/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerPerformer.java
+++ b/mailbox/tools/indexer/src/main/java/org/apache/mailbox/tools/indexer/ReIndexerPerformer.java
@@ -155,7 +155,8 @@ public class ReIndexerPerformer {
             .flatMap(mailbox -> reIndexingEntriesForMailbox(mailbox, mailboxSession, runningOptions), MAILBOX_CONCURRENCY);
 
         return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext)
-            .doFinally(any -> LOGGER.info("Full reindex finished"));
+            .doFinally(any -> LOGGER.info("Full reindex finished"))
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     Mono<Result> reIndexSingleMailbox(MailboxId mailboxId, ReIndexingContext reIndexingContext, RunningOptions runningOptions) {
@@ -165,7 +166,8 @@ public class ReIndexerPerformer {
             .findMailboxById(mailboxId)
             .flatMapMany(mailbox -> reIndexingEntriesForMailbox(mailbox, mailboxSession, runningOptions));
 
-        return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext);
+        return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext)
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     Mono<Result> reIndexUserMailboxes(Username username, ReIndexingContext reIndexingContext, RunningOptions runningOptions) {
@@ -180,7 +182,8 @@ public class ReIndexerPerformer {
                 .flatMap(mailbox -> reIndexingEntriesForMailbox(mailbox, mailboxSession, runningOptions), MAILBOX_CONCURRENCY);
 
             return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext)
-                .doFinally(any -> LOGGER.info("User {} reindex finished", username.asString()));
+                .doFinally(any -> LOGGER.info("User {} reindex finished", username.asString()))
+                .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
         } catch (Exception e) {
             LOGGER.error("Error fetching mailboxes for user: {}", username.asString());
             return Mono.just(Result.PARTIAL);
@@ -195,7 +198,8 @@ public class ReIndexerPerformer {
             .map(mailbox -> new ReIndexingEntry(mailbox, mailboxSession, uid))
             .flatMap(this::fullyReadMessage)
             .flatMap(message -> reIndex(message, mailboxSession))
-            .switchIfEmpty(Mono.just(Result.COMPLETED));
+            .switchIfEmpty(Mono.just(Result.COMPLETED))
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     Mono<Result> reIndexMessageId(MessageId messageId) {
@@ -209,7 +213,8 @@ public class ReIndexerPerformer {
             .onErrorResume(e -> {
                 LOGGER.warn("Failed to re-index {}", messageId, e);
                 return Mono.just(Result.PARTIAL);
-            });
+            })
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 
     Mono<Result> reIndexErrors(ReIndexingContext reIndexingContext, ReIndexingExecutionFailures previousReIndexingFailures, RunningOptions runningOptions) {
@@ -227,7 +232,8 @@ public class ReIndexerPerformer {
                         return Mono.just(Either.left(new MailboxFailure(mailboxId)));
                     }), MAILBOX_CONCURRENCY));
 
-        return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext);
+        return reIndexMessages(entriesToIndex, runningOptions, reIndexingContext)
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     private Mono<Result> reIndex(MailboxMessage mailboxMessage, MailboxSession session) {
diff --git a/mailbox/tools/quota-recompute/src/main/java/org/apache/james/mailbox/quota/task/RecomputeCurrentQuotasService.java b/mailbox/tools/quota-recompute/src/main/java/org/apache/james/mailbox/quota/task/RecomputeCurrentQuotasService.java
index acd288dfe7..f2d1a9c431 100644
--- a/mailbox/tools/quota-recompute/src/main/java/org/apache/james/mailbox/quota/task/RecomputeCurrentQuotasService.java
+++ b/mailbox/tools/quota-recompute/src/main/java/org/apache/james/mailbox/quota/task/RecomputeCurrentQuotasService.java
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import javax.inject.Inject;
 
 import org.apache.james.core.Username;
+import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.SessionProvider;
 import org.apache.james.mailbox.model.QuotaOperation;
@@ -147,18 +148,21 @@ public class RecomputeCurrentQuotasService {
     private final CurrentQuotaCalculator currentQuotaCalculator;
     private final UserQuotaRootResolver userQuotaRootResolver;
     private final SessionProvider sessionProvider;
+    private final MailboxManager mailboxManager;
 
     @Inject
     public RecomputeCurrentQuotasService(UsersRepository usersRepository,
                                          CurrentQuotaManager storeCurrentQuotaManager,
                                          CurrentQuotaCalculator currentQuotaCalculator,
                                          UserQuotaRootResolver userQuotaRootResolver,
-                                         SessionProvider sessionProvider) {
+                                         SessionProvider sessionProvider,
+                                         MailboxManager mailboxManager) {
         this.usersRepository = usersRepository;
         this.storeCurrentQuotaManager = storeCurrentQuotaManager;
         this.currentQuotaCalculator = currentQuotaCalculator;
         this.userQuotaRootResolver = userQuotaRootResolver;
         this.sessionProvider = sessionProvider;
+        this.mailboxManager = mailboxManager;
     }
 
     public Mono<Task.Result> recomputeCurrentQuotas(Context context, RunningOptions runningOptions) {
@@ -190,6 +194,7 @@ public class RecomputeCurrentQuotasService {
                 LOGGER.error("Error while recomputing current quotas for {}", quotaRoot, e);
                 context.addToFailedMailboxes(quotaRoot);
                 return Mono.just(Task.Result.PARTIAL);
-            });
+            })
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 }
diff --git a/server/container/feature-checks/src/main/java/org/apache/james/healthcheck/MailReceptionCheck.java b/server/container/feature-checks/src/main/java/org/apache/james/healthcheck/MailReceptionCheck.java
index c8f31d0844..8d865ee097 100644
--- a/server/container/feature-checks/src/main/java/org/apache/james/healthcheck/MailReceptionCheck.java
+++ b/server/container/feature-checks/src/main/java/org/apache/james/healthcheck/MailReceptionCheck.java
@@ -223,7 +223,8 @@ public class MailReceptionCheck implements HealthCheck {
             .onErrorResume(e -> {
                 LOGGER.error("Mail reception check failed", e);
                 return Mono.just(Result.unhealthy(componentName(), e.getMessage()));
-            });
+            })
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 
     private Mono<MessageManager> retrieveInbox(Username username, MailboxSession session) {
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/ACLUsernameChangeTaskStep.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/ACLUsernameChangeTaskStep.java
index 813dc8a043..7027645eb0 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/ACLUsernameChangeTaskStep.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/ACLUsernameChangeTaskStep.java
@@ -67,7 +67,9 @@ public class ACLUsernameChangeTaskStep implements UsernameChangeTaskStep {
         return mailboxManager.search(MailboxQuery.builder().matchesAllMailboxNames().build(), oldSession)
             .filter(mailbox -> !mailbox.getPath().getUser().equals(oldUsername))
             .concatMap(mailbox -> migrateACLs(oldUsername, newUsername, mailbox))
-            .then(updateSubscriptionsOnDeletedMailboxes(oldUsername, oldSession, newSession));
+            .then(updateSubscriptionsOnDeletedMailboxes(oldUsername, oldSession, newSession))
+            .doFinally(any -> mailboxManager.endProcessingRequest(oldSession))
+            .doFinally(any -> mailboxManager.endProcessingRequest(newSession));
     }
 
     private Mono<Void> updateSubscriptionsOnDeletedMailboxes(Username oldUsername, MailboxSession oldSession, MailboxSession newSession) {
@@ -90,6 +92,7 @@ public class ACLUsernameChangeTaskStep implements UsernameChangeTaskStep {
         return Mono.fromRunnable(Throwing.runnable(() -> mailboxManager.applyRightsCommand(mailbox.getId(), MailboxACL.command().rights(rights).forUser(newUsername).asAddition(), ownerSession)))
             .then(Mono.fromRunnable(Throwing.runnable(() -> mailboxManager.applyRightsCommand(mailbox.getId(), MailboxACL.command().rights(rights).forUser(oldUsername).asRemoval(), ownerSession))))
             .subscribeOn(ReactorUtils.BLOCKING_CALL_WRAPPER)
-            .then();
+            .then()
+            .doFinally(any -> mailboxManager.endProcessingRequest(ownerSession));
     }
 }
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxUsernameChangeTaskStep.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxUsernameChangeTaskStep.java
index cdf02d268a..a28d9544ad 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxUsernameChangeTaskStep.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxUsernameChangeTaskStep.java
@@ -72,7 +72,9 @@ public class MailboxUsernameChangeTaskStep implements UsernameChangeTaskStep {
         return mailboxManager.search(queryUser, MailboxManager.MailboxSearchFetchType.Minimal, fromSession)
             // Only keep top level, rename takes care of sub mailboxes
             .filter(mailbox -> mailbox.getPath().getHierarchyLevels(fromSession.getPathDelimiter()).size() == 1)
-            .concatMap(mailbox -> migrateMailbox(fromSession, toSession, mailbox));
+            .concatMap(mailbox -> migrateMailbox(fromSession, toSession, mailbox))
+            .doFinally(any -> mailboxManager.endProcessingRequest(fromSession))
+            .doFinally(any -> mailboxManager.endProcessingRequest(toSession));
     }
 
     private Mono<Void> migrateMailbox(MailboxSession fromSession, MailboxSession toSession, org.apache.james.mailbox.model.MailboxMetaData mailbox) {
@@ -115,16 +117,20 @@ public class MailboxUsernameChangeTaskStep implements UsernameChangeTaskStep {
         return Flux.fromIterable(mailbox.getResolvedAcls().getEntries().entrySet())
             .filter(entry -> entry.getKey().getNameType() == MailboxACL.NameType.user && !entry.getKey().isNegative())
             .map(entry -> Username.of(entry.getKey().getName()))
-            .concatMap(Throwing.function(userWithAccess ->
-                Flux.from(subscriptionManager.subscriptionsReactive(mailboxManager.createSystemSession(userWithAccess)))
+            .concatMap(Throwing.function(userWithAccess -> {
+                MailboxSession session = mailboxManager.createSystemSession(userWithAccess);
+                return Flux.from(subscriptionManager.subscriptionsReactive(session))
                     .filter(subscribedMailbox -> subscribedMailbox.equals(mailbox.getPath()))
-                    .concatMap(any -> renameSubscription(mailbox, renamedPath, userWithAccess))))
+                    .concatMap(any -> renameSubscription(mailbox, renamedPath, userWithAccess))
+                    .doFinally(any -> mailboxManager.endProcessingRequest(session));
+            }))
             .then();
     }
 
     private Mono<Void> renameSubscription(MailboxMetaData mailbox, MailboxPath renamedPath, Username user) {
         MailboxSession session = mailboxManager.createSystemSession(user);
         return Mono.from(subscriptionManager.subscribeReactive(renamedPath, session))
-            .then(Mono.from(subscriptionManager.unsubscribeReactive(mailbox.getPath(), session)));
+            .then(Mono.from(subscriptionManager.unsubscribeReactive(mailbox.getPath(), session)))
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 }
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
index 6b817023d3..c1eb916848 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
@@ -122,7 +122,8 @@ public class RandomStoring extends GenericMailet {
             MailboxSession session = mailboxManager.createSystemSession(username);
             return mailboxManager
                 .search(MailboxQuery.privateMailboxesBuilder(session).build(), Minimal, session)
-                .map(metaData -> new ReroutingInfos(metaData.getPath().getName(), username));
+                .map(metaData -> new ReroutingInfos(metaData.getPath().getName(), username))
+                .doFinally(any -> mailboxManager.endProcessingRequest(session));
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/send/PostDequeueDecorator.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/send/PostDequeueDecorator.java
index 44daed400f..be51824591 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/send/PostDequeueDecorator.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/send/PostDequeueDecorator.java
@@ -88,6 +88,7 @@ public class PostDequeueDecorator extends MailQueueItemDecorator {
                     MailboxSession mailboxSession = mailboxManager.createSystemSession(Username.of(username.get()));
                     moveFromOutboxToSentWithSeenFlag(messageId, mailboxSession);
                     getMail().setAttribute(IS_DELIVERED);
+                    mailboxManager.endProcessingRequest(mailboxSession);
                 } catch (MailShouldBeInOutboxException e) {
                     LOG.info("Message does not exist on Outbox anymore, it could have already been sent", e);
                 }
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
index e9ce7b9954..6bb65926a9 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/filter/ActionApplier.java
@@ -96,6 +96,7 @@ public class ActionApplier {
         try {
             MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
             MessageManager messageManager = mailboxManager.getMailbox(mailboxId, mailboxSession);
+            mailboxManager.endProcessingRequest(mailboxSession);
 
             String mailboxName = messageManager.getMailboxPath().getName();
 
diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/RestoreService.java b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/RestoreService.java
index e2fcd4890f..caf0913810 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/RestoreService.java
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/RestoreService.java
@@ -79,7 +79,8 @@ class RestoreService {
         MessageManager restoreMessageManager = restoreMailboxManager(session);
 
         return Flux.from(deletedMessageVault.search(usernameToRestore, searchQuery))
-            .flatMap(deletedMessage -> appendToMailbox(restoreMessageManager, deletedMessage, session), DEFAULT_CONCURRENCY);
+            .flatMap(deletedMessage -> appendToMailbox(restoreMessageManager, deletedMessage, session), DEFAULT_CONCURRENCY)
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 
     private Mono<RestoreResult> appendToMailbox(MessageManager restoreMailboxManager, DeletedMessage deletedMessage, MailboxSession session) {
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/CreateMissingParentsTask.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/CreateMissingParentsTask.java
index d8da1c6eba..c92b172c24 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/CreateMissingParentsTask.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/CreateMissingParentsTask.java
@@ -153,6 +153,8 @@ public class CreateMissingParentsTask implements Task {
         } catch (MailboxException e) {
             LOGGER.error("Error fetching mailbox paths", e);
             return Result.PARTIAL;
+        } finally {
+            mailboxManager.endProcessingRequest(session);
         }
     }
 
@@ -160,12 +162,13 @@ public class CreateMissingParentsTask implements Task {
         MailboxSession ownerSession = mailboxManager.createSystemSession(path.getUser());
         return Mono.from(mailboxManager.createMailboxReactive(path, ownerSession))
             .doOnNext(this::recordSuccess)
-        .then(Mono.just(Result.COMPLETED))
-        .onErrorResume(e -> {
-            LOGGER.error("Error creating missing parent mailbox: {}", path.getName(), e);
-            recordFailure(path);
-            return Mono.just(Result.PARTIAL);
-        });
+            .then(Mono.just(Result.COMPLETED))
+            .onErrorResume(e -> {
+                LOGGER.error("Error creating missing parent mailbox: {}", path.getName(), e);
+                recordFailure(path);
+                return Mono.just(Result.PARTIAL);
+            })
+            .doFinally(any -> mailboxManager.endProcessingRequest(ownerSession));
     }
 
     @Override
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/ExpireMailboxService.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/ExpireMailboxService.java
index fc709d4bba..526cbdae45 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/ExpireMailboxService.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/ExpireMailboxService.java
@@ -217,7 +217,8 @@ public class ExpireMailboxService {
                 context.incrementFailedCount();
                 context.incrementProcessedCount();
                 return Mono.just(Task.Result.PARTIAL);
-            });
+            })
+            .doFinally(any -> mailboxManager.endProcessingRequest(session));
     }
 
     private Mono<List<MessageUid>> searchMessagesReactive(MessageManager mgr, MailboxSession session, SearchQuery expiration) {
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
index a7bf0d7291..e57048f5ac 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
@@ -74,6 +74,7 @@ public class UserMailboxesService {
             MailboxPath mailboxPath = MailboxPath.forUser(username, mailboxName.asString())
                 .assertAcceptable(mailboxSession.getPathDelimiter());
             mailboxManager.createMailbox(mailboxPath, mailboxSession);
+            mailboxManager.endProcessingRequest(mailboxSession);
         } catch (MailboxExistsException e) {
             LOGGER.info("Attempt to create mailbox {} for user {} that already exists", mailboxName, username);
         }
@@ -85,14 +86,19 @@ public class UserMailboxesService {
         listUserMailboxes(mailboxSession)
             .map(MailboxMetaData::getPath)
             .forEach(Throwing.consumer(mailboxPath -> deleteMailbox(mailboxSession, mailboxPath)));
+        mailboxManager.endProcessingRequest(mailboxSession);
     }
 
     public List<MailboxResponse> listMailboxes(Username username) throws UsersRepositoryException {
         usernamePreconditions(username);
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
-        return listUserMailboxes(mailboxSession)
-            .map(mailboxMetaData -> new MailboxResponse(mailboxMetaData.getPath().getName(), mailboxMetaData.getId()))
-            .collect(ImmutableList.toImmutableList());
+        try {
+            return listUserMailboxes(mailboxSession)
+                .map(mailboxMetaData -> new MailboxResponse(mailboxMetaData.getPath().getName(), mailboxMetaData.getId()))
+                .collect(ImmutableList.toImmutableList());
+        } finally {
+            mailboxManager.endProcessingRequest(mailboxSession);
+        }
     }
 
     public boolean testMailboxExists(Username username, MailboxName mailboxName) throws MailboxException, UsersRepositoryException {
@@ -100,8 +106,12 @@ public class UserMailboxesService {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
         MailboxPath mailboxPath = MailboxPath.forUser(username, mailboxName.asString())
             .assertAcceptable(mailboxSession.getPathDelimiter());
-        return Mono.from(mailboxManager.mailboxExists(mailboxPath, mailboxSession))
-            .block();
+        try {
+            return Mono.from(mailboxManager.mailboxExists(mailboxPath, mailboxSession))
+                .block();
+        } finally {
+            mailboxManager.endProcessingRequest(mailboxSession);
+        }
     }
 
 
@@ -118,7 +128,8 @@ public class UserMailboxesService {
                 return Mono.just(Result.PARTIAL);
             })
             .reduce(Task::combine)
-            .switchIfEmpty(Mono.just(Result.COMPLETED));
+            .switchIfEmpty(Mono.just(Result.COMPLETED))
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     private Mono<Result> deleteMessage(MessageManager messageManager, MessageUid messageUid, MailboxSession mailboxSession, ClearMailboxContentTask.Context context) {
@@ -138,20 +149,29 @@ public class UserMailboxesService {
             .assertAcceptable(mailboxSession.getPathDelimiter());
         listChildren(mailboxPath, mailboxSession)
             .forEach(Throwing.consumer(path -> deleteMailbox(mailboxSession, path)));
+        mailboxManager.endProcessingRequest(mailboxSession);
     }
 
     public long messageCount(Username username, MailboxName mailboxName) throws UsersRepositoryException, MailboxException {
         usernamePreconditions(username);
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
-        return mailboxManager.getMailbox(MailboxPath.forUser(username, mailboxName.asString()), mailboxSession).getMessageCount(mailboxSession);
+        try {
+            return mailboxManager.getMailbox(MailboxPath.forUser(username, mailboxName.asString()), mailboxSession).getMessageCount(mailboxSession);
+        } finally {
+            mailboxManager.endProcessingRequest(mailboxSession);
+        }
     }
 
     public long unseenMessageCount(Username username, MailboxName mailboxName) throws UsersRepositoryException, MailboxException {
         usernamePreconditions(username);
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
-        return mailboxManager.getMailbox(MailboxPath.forUser(username, mailboxName.asString()), mailboxSession)
-            .getMailboxCounters(mailboxSession)
-            .getUnseen();
+        try {
+            return mailboxManager.getMailbox(MailboxPath.forUser(username, mailboxName.asString()), mailboxSession)
+                .getMailboxCounters(mailboxSession)
+                .getUnseen();
+        } finally {
+            mailboxManager.endProcessingRequest(mailboxSession);
+        }
     }
 
     private Stream<MailboxPath> listChildren(MailboxPath mailboxPath, MailboxSession mailboxSession) {
@@ -178,6 +198,7 @@ public class UserMailboxesService {
             .assertAcceptable(mailboxSession.getPathDelimiter());
         Preconditions.checkState(Boolean.TRUE.equals(Mono.from(mailboxManager.mailboxExists(mailboxPath, mailboxSession)).block()),
             "Mailbox does not exist. " + mailboxPath.asString());
+        mailboxManager.endProcessingRequest(mailboxSession);
     }
 
     private Stream<MailboxMetaData> listUserMailboxes(MailboxSession mailboxSession) {
diff --git a/third-party/rspamd/src/main/java/org/apache/james/rspamd/RspamdListener.java b/third-party/rspamd/src/main/java/org/apache/james/rspamd/RspamdListener.java
index 6af803e4c2..6d9b1c5613 100644
--- a/third-party/rspamd/src/main/java/org/apache/james/rspamd/RspamdListener.java
+++ b/third-party/rspamd/src/main/java/org/apache/james/rspamd/RspamdListener.java
@@ -101,10 +101,12 @@ public class RspamdListener implements SpamEventListener, EventListener.Reactive
     }
 
     private Mono<Void> handleMessageAdded(MailboxEvents.Added addedEvent) {
+        MailboxSession mailboxSession = mailboxManager.createSystemSession(Username.of(getClass().getCanonicalName()));
         return isAppendedToInbox(addedEvent)
             .filter(FunctionalUtils.identityPredicate())
             .doOnNext(isHam -> LOGGER.debug("Ham event detected, EventId = {}", addedEvent.getEventId().getId()))
-            .flatMap(any -> reportHamWhenAdded(addedEvent, mailboxManager.createSystemSession(Username.of(getClass().getCanonicalName()))));
+            .flatMap(any -> reportHamWhenAdded(addedEvent, mailboxSession))
+            .then(Mono.fromRunnable(() -> mailboxManager.endProcessingRequest(mailboxSession)));
     }
 
     private Mono<Void> handleMessageMoved(MessageMoveEvent messageMoveEvent) {
@@ -123,9 +125,11 @@ public class RspamdListener implements SpamEventListener, EventListener.Reactive
     }
 
     private Flux<ByteBuffer> mailboxMessagePublisher(MessageMoveEvent messageMoveEvent) {
-        return Mono.fromCallable(() -> mapperFactory.getMessageIdMapper(mailboxManager.createSystemSession(Username.of(getClass().getCanonicalName()))))
+        MailboxSession mailboxSession = mailboxManager.createSystemSession(Username.of(getClass().getCanonicalName()));
+        return Mono.fromCallable(() -> mapperFactory.getMessageIdMapper(mailboxSession))
             .flatMapMany(messageIdMapper -> messageIdMapper.findReactive(messageMoveEvent.getMessageIds(), MessageMapper.FetchType.FULL))
-            .flatMap(MailboxMessage::getFullContentReactive);
+            .flatMap(MailboxMessage::getFullContentReactive)
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     private Mono<Void> handleMessageMoved(Flux<ByteBuffer> mailboxMessagesPublisher, MessageMoveEvent messageMoveEvent) {
diff --git a/third-party/rspamd/src/main/java/org/apache/james/rspamd/task/GetMailboxMessagesService.java b/third-party/rspamd/src/main/java/org/apache/james/rspamd/task/GetMailboxMessagesService.java
index 55bbb1b089..447fd17687 100644
--- a/third-party/rspamd/src/main/java/org/apache/james/rspamd/task/GetMailboxMessagesService.java
+++ b/third-party/rspamd/src/main/java/org/apache/james/rspamd/task/GetMailboxMessagesService.java
@@ -102,7 +102,8 @@ public class GetMailboxMessagesService {
             .doOnNext(mailboxMessageMetaData -> context.incrementSpamMessageCount())
             .filter(message -> randomBooleanWithProbability(runningOptions))
             .flatMap(message -> messageIdManager.getMessagesReactive(List.of(message.getMessageId()), FetchGroup.FULL_CONTENT, mailboxSession), ReactorUtils.DEFAULT_CONCURRENCY)
-            .filter(runningOptions.correspondingClassificationFilter());
+            .filter(runningOptions.correspondingClassificationFilter())
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     private Flux<MessageResult> getMailboxMessagesOfAUser(Username username, MailboxMetaData mailboxMetaData, Optional<Date> afterDate,
@@ -119,7 +120,8 @@ public class GetMailboxMessagesService {
             .doOnNext(mailboxMessageMetaData -> context.incrementHamMessageCount())
             .filter(message -> randomBooleanWithProbability(runningOptions))
             .flatMap(message -> messageIdManager.getMessagesReactive(List.of(message.getMessageId()), FetchGroup.FULL_CONTENT, mailboxSession), ReactorUtils.DEFAULT_CONCURRENCY)
-            .filter(runningOptions.correspondingClassificationFilter());
+            .filter(runningOptions.correspondingClassificationFilter())
+            .doFinally(any -> mailboxManager.endProcessingRequest(mailboxSession));
     }
 
     public static boolean randomBooleanWithProbability(RunningOptions runningOptions) {
diff --git a/third-party/spamassassin/src/main/java/org/apache/james/spamassassin/SpamAssassinListener.java b/third-party/spamassassin/src/main/java/org/apache/james/spamassassin/SpamAssassinListener.java
index 19a86262df..cace69aef6 100644
--- a/third-party/spamassassin/src/main/java/org/apache/james/spamassassin/SpamAssassinListener.java
+++ b/third-party/spamassassin/src/main/java/org/apache/james/spamassassin/SpamAssassinListener.java
@@ -97,10 +97,12 @@ public class SpamAssassinListener implements SpamEventListener {
         if (event instanceof MessageMoveEvent) {
             MailboxSession session = mailboxManager.createSystemSession(username);
             handleMessageMove(event, session, (MessageMoveEvent) event);
+            mailboxManager.endProcessingRequest(session);
         }
         if (event instanceof Added) {
             MailboxSession session = mailboxManager.createSystemSession(username);
             handleAdded(event, session, (Added) event);
+            mailboxManager.endProcessingRequest(session);
         }
     }
 


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


[james-project] 08/28: [PERF] JPA: reuse EntityManager where possible (#1582)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 859cd50d7f162450e7fdfc65a33f5b102742cd4e
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Fri Jun 9 13:58:48 2023 +0700

    [PERF] JPA: reuse EntityManager where possible (#1582)
---
 .../jpa/JPAMailboxSessionMapperFactory.java        |  8 +-
 .../james/mailbox/jpa/mail/JPAMessageMapper.java   | 15 ++--
 .../james/mailbox/jpa/mail/JPAModSeqProvider.java  | 16 ++--
 .../james/mailbox/jpa/mail/JPAUidProvider.java     | 13 +++-
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java   | 85 +++++++-------------
 .../jpa/quota/JPAPerUserMaxQuotaManager.java       | 90 +++++++++++++++++-----
 .../main/resources/META-INF/spring/mailbox-jpa.xml |  3 +-
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java  |  2 +-
 .../mpt/imapmailbox/jpa/host/JPAHostSystem.java    |  2 +-
 9 files changed, 132 insertions(+), 102 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java
index cb7e0103a9..b751e92d5b 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java
@@ -28,6 +28,8 @@ import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.jpa.mail.JPAAnnotationMapper;
 import org.apache.james.mailbox.jpa.mail.JPAMailboxMapper;
 import org.apache.james.mailbox.jpa.mail.JPAMessageMapper;
+import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider;
+import org.apache.james.mailbox.jpa.mail.JPAUidProvider;
 import org.apache.james.mailbox.jpa.user.JPASubscriptionMapper;
 import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
 import org.apache.james.mailbox.store.mail.AnnotationMapper;
@@ -45,11 +47,11 @@ import org.apache.james.mailbox.store.user.SubscriptionMapper;
 public class JPAMailboxSessionMapperFactory extends MailboxSessionMapperFactory {
 
     private final EntityManagerFactory entityManagerFactory;
-    private final UidProvider uidProvider;
-    private final ModSeqProvider modSeqProvider;
+    private final JPAUidProvider uidProvider;
+    private final JPAModSeqProvider modSeqProvider;
 
     @Inject
-    public JPAMailboxSessionMapperFactory(EntityManagerFactory entityManagerFactory, UidProvider uidProvider, ModSeqProvider modSeqProvider) {
+    public JPAMailboxSessionMapperFactory(EntityManagerFactory entityManagerFactory, JPAUidProvider uidProvider, JPAModSeqProvider modSeqProvider) {
         this.entityManagerFactory = entityManagerFactory;
         this.uidProvider = uidProvider;
         this.modSeqProvider = modSeqProvider;
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
index c9a05f7cc9..da2b5fd2a4 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
@@ -49,8 +49,6 @@ import org.apache.james.mailbox.model.MessageRange.Type;
 import org.apache.james.mailbox.model.UpdatedFlags;
 import org.apache.james.mailbox.store.FlagsUpdateCalculator;
 import org.apache.james.mailbox.store.mail.MessageMapper;
-import org.apache.james.mailbox.store.mail.ModSeqProvider;
-import org.apache.james.mailbox.store.mail.UidProvider;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.utils.ApplicableFlagCalculator;
 import org.apache.openjpa.persistence.ArgumentException;
@@ -70,10 +68,10 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
     private static final int UNLIMITED = -1;
 
     private final MessageUtils messageMetadataMapper;
-    private final UidProvider uidProvider;
-    private final ModSeqProvider modSeqProvider;
+    private final JPAUidProvider uidProvider;
+    private final JPAModSeqProvider modSeqProvider;
 
-    public JPAMessageMapper(UidProvider uidProvider, ModSeqProvider modSeqProvider, EntityManagerFactory entityManagerFactory) {
+    public JPAMessageMapper(JPAUidProvider uidProvider, JPAModSeqProvider modSeqProvider, EntityManagerFactory entityManagerFactory) {
         super(entityManagerFactory);
         this.messageMetadataMapper = new MessageUtils(uidProvider, modSeqProvider);
         this.uidProvider = uidProvider;
@@ -326,12 +324,12 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
 
     @Override
     public Optional<MessageUid> getLastUid(Mailbox mailbox) throws MailboxException {
-        return uidProvider.lastUid(mailbox);
+        return uidProvider.lastUid(mailbox, getEntityManager());
     }
 
     @Override
     public ModSeq getHighestModSeq(Mailbox mailbox) throws MailboxException {
-        return modSeqProvider.highestModSeq(mailbox);
+        return modSeqProvider.highestModSeq(mailbox.getMailboxId(), getEntityManager());
     }
 
     @Override
@@ -356,9 +354,6 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
         return save(mailbox, copy);
     }
 
-    /**
-     * @see org.apache.james.mailbox.store.mail.AbstractMessageMapper#save(Mailbox, MailboxMessage)
-     */
     protected MessageMetaData save(Mailbox mailbox, MailboxMessage message) throws MailboxException {
         try {
             // We need to reload a "JPA attached" mailbox, because the provide
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAModSeqProvider.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAModSeqProvider.java
index 6f4181916a..5f1414d32c 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAModSeqProvider.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAModSeqProvider.java
@@ -83,17 +83,23 @@ public class JPAModSeqProvider implements ModSeqProvider {
     }
 
     private ModSeq highestModSeq(JPAId mailboxId) throws MailboxException {
-        EntityManager manager = null;
+        EntityManager manager = factory.createEntityManager();
+        try {
+            return highestModSeq(mailboxId, manager);
+        } finally {
+            EntityManagerUtils.safelyClose(manager);
+        }
+    }
+
+    public ModSeq highestModSeq(MailboxId mailboxId, EntityManager manager) throws MailboxException {
+        JPAId jpaId = (JPAId) mailboxId;
         try {
-            manager = factory.createEntityManager();
             long highest = (Long) manager.createNamedQuery("findHighestModSeq")
-                .setParameter("idParam", mailboxId.getRawId())
+                .setParameter("idParam", jpaId.getRawId())
                 .getSingleResult();
             return ModSeq.of(highest);
         } catch (PersistenceException e) {
             throw new MailboxException("Unable to get highest mod-sequence for mailbox " + mailboxId.serialize(), e);
-        } finally {
-            EntityManagerUtils.safelyClose(manager);
         }
     }
 }
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAUidProvider.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAUidProvider.java
index 85e140eaa3..94e197b4f9 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAUidProvider.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAUidProvider.java
@@ -45,9 +45,16 @@ public class JPAUidProvider implements UidProvider {
 
     @Override
     public Optional<MessageUid> lastUid(Mailbox mailbox) throws MailboxException {
-        EntityManager manager = null;
+        EntityManager manager = factory.createEntityManager();
+        try {
+            return lastUid(mailbox, manager);
+        } finally {
+            EntityManagerUtils.safelyClose(manager);
+        }
+    }
+
+    public Optional<MessageUid> lastUid(Mailbox mailbox, EntityManager manager) throws MailboxException {
         try {
-            manager = factory.createEntityManager();
             JPAId mailboxId = (JPAId) mailbox.getMailboxId();
             long uid = (Long) manager.createNamedQuery("findLastUid").setParameter("idParam", mailboxId.getRawId()).getSingleResult();
             if (uid == 0) {
@@ -56,8 +63,6 @@ public class JPAUidProvider implements UidProvider {
             return Optional.of(MessageUid.of(uid));
         } catch (PersistenceException e) {
             throw new MailboxException("Unable to get last uid for mailbox " + mailbox, e);
-        } finally {
-            EntityManagerUtils.safelyClose(manager);
         }
     }
 
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
index fa1fcffaca..8b28dbba69 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
@@ -26,7 +26,6 @@ import javax.inject.Inject;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
-import org.apache.james.backends.jpa.EntityManagerUtils;
 import org.apache.james.backends.jpa.TransactionRunner;
 import org.apache.james.core.Domain;
 import org.apache.james.core.quota.QuotaCountLimit;
@@ -43,12 +42,10 @@ import org.apache.james.mailbox.model.QuotaRoot;
 public class JPAPerUserMaxQuotaDAO {
 
     private static final long INFINITE = -1;
-    private final EntityManagerFactory entityManagerFactory;
     private final TransactionRunner transactionRunner;
 
     @Inject
     public JPAPerUserMaxQuotaDAO(EntityManagerFactory entityManagerFactory) {
-        this.entityManagerFactory = entityManagerFactory;
         this.transactionRunner = new TransactionRunner(entityManagerFactory);
     }
 
@@ -162,82 +159,52 @@ public class JPAPerUserMaxQuotaDAO {
         return storedValue;
     }
 
-    public Optional<QuotaSizeLimit> getGlobalMaxStorage() {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
-            MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY);
-            if (storedValue == null) {
-                return Optional.empty();
-            }
-            return longToQuotaSize(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
+    public Optional<QuotaSizeLimit> getGlobalMaxStorage(EntityManager entityManager) {
+        MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY);
+        if (storedValue == null) {
+            return Optional.empty();
         }
+        return longToQuotaSize(storedValue.getValue());
     }
 
-    public Optional<QuotaCountLimit> getGlobalMaxMessage() {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
-            MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY);
-            if (storedValue == null) {
-                return Optional.empty();
-            }
-            return longToQuotaCount(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
+    public Optional<QuotaCountLimit> getGlobalMaxMessage(EntityManager entityManager) {
+        MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY);
+        if (storedValue == null) {
+            return Optional.empty();
         }
+        return longToQuotaCount(storedValue.getValue());
     }
 
-    public Optional<QuotaSizeLimit> getMaxStorage(QuotaRoot quotaRoot) {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
-            MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue());
-            if (storedValue == null) {
-                return Optional.empty();
-            }
-            return longToQuotaSize(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
+    public Optional<QuotaSizeLimit> getMaxStorage(EntityManager entityManager, QuotaRoot quotaRoot) {
+        MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue());
+        if (storedValue == null) {
+            return Optional.empty();
         }
+        return longToQuotaSize(storedValue.getValue());
     }
 
-    public Optional<QuotaCountLimit> getMaxMessage(QuotaRoot quotaRoot) {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
-            MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue());
-            if (storedValue == null) {
-                return Optional.empty();
-            }
-            return longToQuotaCount(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
+    public Optional<QuotaCountLimit> getMaxMessage(EntityManager entityManager, QuotaRoot quotaRoot) {
+        MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue());
+        if (storedValue == null) {
+            return Optional.empty();
         }
+        return longToQuotaCount(storedValue.getValue());
     }
 
-    public Optional<QuotaCountLimit> getDomainMaxMessage(Domain domain) {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
+    public Optional<QuotaCountLimit> getDomainMaxMessage(EntityManager entityManager, Domain domain) {
             MaxDomainMessageCount storedValue = entityManager.find(MaxDomainMessageCount.class, domain.asString());
             if (storedValue == null) {
                 return Optional.empty();
             }
             return longToQuotaCount(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
-        }
     }
 
-    public Optional<QuotaSizeLimit> getDomainMaxStorage(Domain domain) {
-        EntityManager entityManager = entityManagerFactory.createEntityManager();
-        try {
-            MaxDomainStorage storedValue = entityManager.find(MaxDomainStorage.class, domain.asString());
-            if (storedValue == null) {
-                return Optional.empty();
-            }
-            return longToQuotaSize(storedValue.getValue());
-        } finally {
-            EntityManagerUtils.safelyClose(entityManager);
+    public Optional<QuotaSizeLimit> getDomainMaxStorage(EntityManager entityManager, Domain domain) {
+        MaxDomainStorage storedValue = entityManager.find(MaxDomainStorage.class, domain.asString());
+        if (storedValue == null) {
+            return Optional.empty();
         }
+        return longToQuotaSize(storedValue.getValue());
     }
 
 
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
index 8b29dbdb88..31658c0c6a 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
@@ -25,8 +25,11 @@ import java.util.function.Function;
 import java.util.stream.Stream;
 
 import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
 
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.james.backends.jpa.EntityManagerUtils;
 import org.apache.james.core.Domain;
 import org.apache.james.core.quota.QuotaCountLimit;
 import org.apache.james.core.quota.QuotaSizeLimit;
@@ -39,13 +42,15 @@ import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.ImmutableMap;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
-
+    private final EntityManagerFactory entityManagerFactory;
     private final JPAPerUserMaxQuotaDAO dao;
 
     @Inject
-    public JPAPerUserMaxQuotaManager(JPAPerUserMaxQuotaDAO dao) {
+    public JPAPerUserMaxQuotaManager(EntityManagerFactory entityManagerFactory, JPAPerUserMaxQuotaDAO dao) {
+        this.entityManagerFactory = entityManagerFactory;
         this.dao = dao;
     }
 
@@ -111,7 +116,12 @@ public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public Optional<QuotaCountLimit> getDomainMaxMessage(Domain domain) {
-        return dao.getDomainMaxMessage(domain);
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return dao.getDomainMaxMessage(entityManager, domain);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
     }
 
     @Override
@@ -122,7 +132,12 @@ public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public Optional<QuotaSizeLimit> getDomainMaxStorage(Domain domain) {
-        return dao.getDomainMaxStorage(domain);
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return dao.getDomainMaxStorage(entityManager, domain);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
     }
 
     @Override
@@ -173,7 +188,12 @@ public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public Optional<QuotaSizeLimit> getGlobalMaxStorage() {
-        return dao.getGlobalMaxStorage();
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return dao.getGlobalMaxStorage(entityManager);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
     }
 
     @Override
@@ -184,7 +204,12 @@ public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public Optional<QuotaCountLimit> getGlobalMaxMessage() {
-        return dao.getGlobalMaxMessage();
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return dao.getGlobalMaxMessage(entityManager);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
     }
 
     @Override
@@ -193,26 +218,55 @@ public class JPAPerUserMaxQuotaManager implements MaxQuotaManager {
             .flatMap(Mono::justOrEmpty);
     }
 
+    @Override
+    public Publisher<QuotaDetails> quotaDetailsReactive(QuotaRoot quotaRoot) {
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        return Mono.zip(
+                Mono.fromCallable(() -> listMaxMessagesDetails(quotaRoot, entityManager)),
+                Mono.fromCallable(() -> listMaxStorageDetails(quotaRoot, entityManager)))
+            .map(tuple -> new QuotaDetails(tuple.getT1(), tuple.getT2()))
+            .subscribeOn(Schedulers.boundedElastic())
+            .doFinally(any -> EntityManagerUtils.safelyClose(entityManager));
+    }
+
     @Override
     public Map<Quota.Scope, QuotaCountLimit> listMaxMessagesDetails(QuotaRoot quotaRoot) {
-        Function<Domain, Optional<QuotaCountLimit>> domainQuotaFunction = Throwing.function(this::getDomainMaxMessage).sneakyThrow();
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return listMaxMessagesDetails(quotaRoot, entityManager);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
+    }
+
+    private ImmutableMap<Quota.Scope, QuotaCountLimit> listMaxMessagesDetails(QuotaRoot quotaRoot, EntityManager entityManager) {
+        Function<Domain, Optional<QuotaCountLimit>> domainQuotaFunction = Throwing.function(domain -> dao.getDomainMaxMessage(entityManager, domain));
         return Stream.of(
-            Pair.of(Quota.Scope.User, dao.getMaxMessage(quotaRoot)),
-            Pair.of(Quota.Scope.Domain, quotaRoot.getDomain().flatMap(domainQuotaFunction)),
-            Pair.of(Quota.Scope.Global, dao.getGlobalMaxMessage()))
-        .filter(pair -> pair.getValue().isPresent())
-        .collect(ImmutableMap.toImmutableMap(Pair::getKey, value -> value.getValue().get()));
+                Pair.of(Quota.Scope.User, dao.getMaxMessage(entityManager, quotaRoot)),
+                Pair.of(Quota.Scope.Domain, quotaRoot.getDomain().flatMap(domainQuotaFunction)),
+                Pair.of(Quota.Scope.Global, dao.getGlobalMaxMessage(entityManager)))
+            .filter(pair -> pair.getValue().isPresent())
+            .collect(ImmutableMap.toImmutableMap(Pair::getKey, value -> value.getValue().get()));
     }
 
     @Override
     public Map<Quota.Scope, QuotaSizeLimit> listMaxStorageDetails(QuotaRoot quotaRoot) {
-        Function<Domain, Optional<QuotaSizeLimit>> domainQuotaFunction = Throwing.function(this::getDomainMaxStorage).sneakyThrow();
+        EntityManager entityManager = entityManagerFactory.createEntityManager();
+        try {
+            return listMaxStorageDetails(quotaRoot, entityManager);
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
+        }
+    }
+
+    private ImmutableMap<Quota.Scope, QuotaSizeLimit> listMaxStorageDetails(QuotaRoot quotaRoot, EntityManager entityManager) {
+        Function<Domain, Optional<QuotaSizeLimit>> domainQuotaFunction = Throwing.function(domain -> dao.getDomainMaxStorage(entityManager, domain));
         return Stream.of(
-            Pair.of(Quota.Scope.User, dao.getMaxStorage(quotaRoot)),
-            Pair.of(Quota.Scope.Domain, quotaRoot.getDomain().flatMap(domainQuotaFunction)),
-            Pair.of(Quota.Scope.Global, dao.getGlobalMaxStorage()))
-        .filter(pair -> pair.getValue().isPresent())
-        .collect(ImmutableMap.toImmutableMap(Pair::getKey, value -> value.getValue().get()));
+                Pair.of(Quota.Scope.User, dao.getMaxStorage(entityManager, quotaRoot)),
+                Pair.of(Quota.Scope.Domain, quotaRoot.getDomain().flatMap(domainQuotaFunction)),
+                Pair.of(Quota.Scope.Global, dao.getGlobalMaxStorage(entityManager)))
+            .filter(pair -> pair.getValue().isPresent())
+            .collect(ImmutableMap.toImmutableMap(Pair::getKey, value -> value.getValue().get()));
     }
 
     @Override
diff --git a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
index e0fa9d0fd8..c673f3bc97 100644
--- a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
+++ b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
@@ -98,7 +98,8 @@
     </bean>
 
     <bean id="jpaMaxQuotaManager" class="org.apache.james.mailbox.jpa.quota.JPAPerUserMaxQuotaManager">
-        <constructor-arg index="0" ref="jpa-per-user-max-quota-dao"/>
+        <constructor-arg index="0" ref="entityManagerFactory"/>
+        <constructor-arg index="1" ref="jpa-per-user-max-quota-dao"/>
     </bean>
     <bean id="jpaCurrentQuotaManager" class="org.apache.james.mailbox.jpa.quota.JpaCurrentQuotaManager">
         <constructor-arg index="0" ref="entityManagerFactory"/>
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
index 6c5df68fad..8cb8f8be85 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
@@ -31,7 +31,7 @@ class JPAPerUserMaxQuotaTest extends GenericMaxQuotaManagerTest {
 
     @Override
     protected MaxQuotaManager provideMaxQuotaManager() {
-        return new JPAPerUserMaxQuotaManager(new JPAPerUserMaxQuotaDAO(JPA_TEST_CLUSTER.getEntityManagerFactory()));
+        return new JPAPerUserMaxQuotaManager(JPA_TEST_CLUSTER.getEntityManagerFactory(), new JPAPerUserMaxQuotaDAO(JPA_TEST_CLUSTER.getEntityManagerFactory()));
     }
 
     @AfterEach
diff --git a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
index f2ecfd6b74..b6da87ec69 100644
--- a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
+++ b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
@@ -111,7 +111,7 @@ public class JPAHostSystem extends JamesImapHostSystem {
         SessionProviderImpl sessionProvider = new SessionProviderImpl(authenticator, authorizator);
         DefaultUserQuotaRootResolver quotaRootResolver = new DefaultUserQuotaRootResolver(sessionProvider, mapperFactory);
         JpaCurrentQuotaManager currentQuotaManager = new JpaCurrentQuotaManager(entityManagerFactory);
-        maxQuotaManager = new JPAPerUserMaxQuotaManager(new JPAPerUserMaxQuotaDAO(entityManagerFactory));
+        maxQuotaManager = new JPAPerUserMaxQuotaManager(entityManagerFactory, new JPAPerUserMaxQuotaDAO(entityManagerFactory));
         StoreQuotaManager storeQuotaManager = new StoreQuotaManager(currentQuotaManager, maxQuotaManager);
         ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, storeQuotaManager);
         QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, storeQuotaManager, quotaRootResolver);


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


[james-project] 15/28: JAMES-3906 Add a missing license

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e0178ad314eb774edaeb601b1daf56f8108fe682
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu May 25 11:10:20 2023 +0700

    JAMES-3906 Add a missing license
---
 .../apache/james/imapserver/webadmin/ImapRoutes.java  | 18 ++++++++++++++++++
 .../protocols/lib/netty/CertificateReloadable.java    | 18 ++++++++++++++++++
 .../james/pop3server/netty/POP3ServerFactory.java     | 19 +++++++++++++++++++
 3 files changed, 55 insertions(+)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
index 843106583c..77cb9375f8 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
@@ -1,3 +1,21 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
 package org.apache.james.imapserver.webadmin;
 
 import javax.inject.Inject;
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
index 7ac6f2a44b..248de22857 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java
@@ -1,3 +1,21 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
 package org.apache.james.protocols.lib.netty;
 
 public interface CertificateReloadable {
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java
index d146360152..fcce3b306e 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.pop3server.netty;
 
 import java.util.ArrayList;


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


[james-project] 26/28: JAMES-3914 ActionUtils: drop no longer used method

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e8d9fc67604cb5399e013fd763d2d37d95432f16
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 16:26:41 2023 +0700

    JAMES-3914 ActionUtils: drop no longer used method
---
 .../james/transport/mailets/jsieve/ActionUtils.java       | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
index 94884c1261..692ef0e9e1 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java
@@ -40,21 +40,6 @@ public class ActionUtils {
 
     private static final String ATTRIBUTE_PREFIX = ActionUtils.class.getPackage().getName() + ".";
 
-    /**
-     * Answers the sole intended recipient for aMail.
-     */
-    public static MailAddress getSoleRecipient(Mail aMail) throws MessagingException {
-        if (aMail.getRecipients() == null) {
-            throw new MessagingException("Invalid number of recipients - 0"
-                    + ". Exactly 1 recipient is expected.");
-        } else if (1 != aMail.getRecipients().size()) {
-            throw new MessagingException("Invalid number of recipients - "
-                + aMail.getRecipients().size()
-                + ". Exactly 1 recipient is expected.");
-        }
-        return aMail.getRecipients().iterator().next();
-    }
-
     /**
      * Detect and handle locally looping mail. External loop detection is left
      * to the MTA.


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


[james-project] 11/28: JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 2533185267c747825ad245043fc034232dcb80b9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jun 9 18:41:57 2023 +0700

    JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager
---
 .../mailbox/jpa/openjpa/OpenJPAMessageManager.java | 37 +++++++++++++++++++++-
 .../james/mailbox/store/StoreMailboxManager.java   |  2 +-
 .../james/mailbox/store/StoreMessageManager.java   | 10 +++---
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java
index 567e8d5ac6..7226fb046a 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java
@@ -20,14 +20,18 @@
 package org.apache.james.mailbox.jpa.openjpa;
 
 import java.time.Clock;
+import java.util.EnumSet;
 
 import javax.mail.Flags;
 
 import org.apache.james.events.EventBus;
 import org.apache.james.mailbox.MailboxPathLocker;
 import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Mailbox;
+import org.apache.james.mailbox.model.MailboxACL;
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.mailbox.model.UidValidity;
 import org.apache.james.mailbox.quota.QuotaManager;
 import org.apache.james.mailbox.quota.QuotaRootResolver;
 import org.apache.james.mailbox.store.BatchSizes;
@@ -37,23 +41,35 @@ import org.apache.james.mailbox.store.PreDeletionHooks;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreMessageManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.ThreadIdGuessingAlgorithm;
 import org.apache.james.mailbox.store.search.MessageSearchIndex;
 
+import com.github.fge.lambdas.Throwing;
+
+import reactor.core.publisher.Mono;
+
 /**
  * OpenJPA implementation of Mailbox
  */
 public class OpenJPAMessageManager extends StoreMessageManager {
+    private final MailboxSessionMapperFactory mapperFactory;
+    private final StoreRightManager storeRightManager;
+    private final Mailbox mailbox;
 
     public OpenJPAMessageManager(MailboxSessionMapperFactory mapperFactory,
                                  MessageSearchIndex index, EventBus eventBus,
                                  MailboxPathLocker locker, Mailbox mailbox,
                                  QuotaManager quotaManager, QuotaRootResolver quotaRootResolver,
                                  MessageId.Factory messageIdFactory, BatchSizes batchSizes,
-                                 StoreRightManager storeRightManager, ThreadIdGuessingAlgorithm threadIdGuessingAlgorithm, Clock clock) {
+                                 StoreRightManager storeRightManager, ThreadIdGuessingAlgorithm threadIdGuessingAlgorithm,
+                                 Clock clock) {
         super(StoreMailboxManager.DEFAULT_NO_MESSAGE_CAPABILITIES, mapperFactory, index, eventBus, locker, mailbox,
             quotaManager, quotaRootResolver, batchSizes, storeRightManager, PreDeletionHooks.NO_PRE_DELETION_HOOK,
             new MessageStorer.WithoutAttachment(mapperFactory, messageIdFactory, new OpenJPAMessageFactory(OpenJPAMessageFactory.AdvancedFeature.None), threadIdGuessingAlgorithm, clock));
+        this.storeRightManager = storeRightManager;
+        this.mapperFactory = mapperFactory;
+        this.mailbox = mailbox;
     }
 
     /**
@@ -65,4 +81,23 @@ public class OpenJPAMessageManager extends StoreMessageManager {
         flags.add(Flags.Flag.USER);
         return flags;
     }
+
+    public Mono<MailboxMetaData> getMetaDataReactive(MailboxMetaData.RecentMode recentMode, MailboxSession mailboxSession, EnumSet<MailboxMetaData.Item> items) throws MailboxException {
+        MailboxACL resolvedAcl = getResolvedAcl(mailboxSession);
+        if (!storeRightManager.hasRight(mailbox, MailboxACL.Right.Read, mailboxSession)) {
+            return Mono.just(MailboxMetaData.sensibleInformationFree(resolvedAcl, getMailboxEntity().getUidValidity(), isWriteable(mailboxSession)));
+        }
+        Flags permanentFlags = getPermanentFlags(mailboxSession);
+        UidValidity uidValidity = getMailboxEntity().getUidValidity();
+        MessageMapper messageMapper = mapperFactory.getMessageMapper(mailboxSession);
+
+        return messageMapper.executeReactive(
+            nextUid(messageMapper, items)
+                .flatMap(nextUid -> highestModSeq(messageMapper, items)
+                    .flatMap(highestModSeq -> firstUnseen(messageMapper, items)
+                        .flatMap(Throwing.function(firstUnseen -> recent(recentMode, mailboxSession)
+                            .flatMap(recents -> mailboxCounters(messageMapper, items)
+                                .map(counters -> new MailboxMetaData(recents, permanentFlags, uidValidity, nextUid, highestModSeq, counters.getCount(),
+                                    counters.getUnseen(), firstUnseen.orElse(null), isWriteable(mailboxSession), resolvedAcl))))))));
+    }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index 5c530d907f..e1d272c5f8 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -658,7 +658,7 @@ public class StoreMailboxManager implements MailboxManager {
                 return mailboxId;
             })
             .then(Mono.from(locker.executeReactiveWithLockReactive(from, mapper.findMailboxWithPathLike(query)
-                    .flatMap(sub -> {
+                    .concatMap(sub -> {
                         String subOriginalName = sub.getName();
                         String subNewName = newMailboxPath.getName() + subOriginalName.substring(from.getName().length());
                         MailboxPath fromPath = new MailboxPath(from, subOriginalName);
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
index 8ef76f2931..a5fe322689 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
@@ -594,14 +594,14 @@ public class StoreMessageManager implements MessageManager {
                 t5.getT4().getUnseen(), t5.getT3().orElse(null), isWriteable(mailboxSession), resolvedAcl)));
     }
 
-    private Mono<ModSeq> highestModSeq(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
+    protected Mono<ModSeq> highestModSeq(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
         if (items.contains(MailboxMetaData.Item.HighestModSeq)) {
             return messageMapper.getHighestModSeqReactive(mailbox);
         }
         return Mono.just(ModSeq.first());
     }
 
-    private Mono<MessageUid> nextUid(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
+    protected Mono<MessageUid> nextUid(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
         if (items.contains(MailboxMetaData.Item.NextUid)) {
             return messageMapper.getLastUidReactive(mailbox)
                 .map(optional -> optional
@@ -611,14 +611,14 @@ public class StoreMessageManager implements MessageManager {
         return Mono.just(MessageUid.MIN_VALUE);
     }
 
-    private Mono<Optional<MessageUid>> firstUnseen(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
+    protected Mono<Optional<MessageUid>> firstUnseen(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
         if (items.contains(MailboxMetaData.Item.FirstUnseen)) {
             return messageMapper.findFirstUnseenMessageUidReactive(getMailboxEntity());
         }
         return Mono.just(Optional.empty());
     }
 
-    private Mono<MailboxCounters> mailboxCounters(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
+    protected Mono<MailboxCounters> mailboxCounters(MessageMapper messageMapper, EnumSet<MailboxMetaData.Item> items) {
         if (items.contains(MailboxMetaData.Item.MailboxCounters)) {
             return messageMapper.getMailboxCountersReactive(getMailboxEntity());
         }
@@ -777,7 +777,7 @@ public class StoreMessageManager implements MessageManager {
      * Return a List which holds all uids of recent messages and optional reset
      * the recent flag on the messages for the uids
      */
-    private Mono<List<MessageUid>> recent(RecentMode recentMode, MailboxSession mailboxSession) throws MailboxException {
+    protected Mono<List<MessageUid>> recent(RecentMode recentMode, MailboxSession mailboxSession) throws MailboxException {
         MessageMapper messageMapper = mapperFactory.getMessageMapper(mailboxSession);
 
         switch (recentMode) {


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


[james-project] 17/28: JAMES-3906 Allow SSL reload of a specific server via the port number

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit a8d36a520fcbe4eed08bf0fb31ee5e1950887c5c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu May 25 11:25:06 2023 +0700

    JAMES-3906 Allow SSL reload of a specific server via the port number
---
 .../apache/james/protocols/webadmin/ProtocolServerRoutes.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
index 4dabb780c1..028b75f3e1 100644
--- a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
+++ b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
@@ -19,12 +19,14 @@
 
 package org.apache.james.protocols.webadmin;
 
+import java.util.Optional;
 import java.util.Set;
 
 import javax.inject.Inject;
 
 import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
 import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.util.Port;
 import org.apache.james.webadmin.Routes;
 import org.apache.james.webadmin.utils.ErrorResponder;
 import org.apache.james.webadmin.utils.Responses;
@@ -32,7 +34,9 @@ import org.eclipse.jetty.http.HttpStatus;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.base.Preconditions;
+import com.google.common.base.Predicate;
 
+import spark.Request;
 import spark.Service;
 
 public class ProtocolServerRoutes implements Routes {
@@ -67,12 +71,19 @@ public class ProtocolServerRoutes implements Routes {
             servers.stream()
                 .flatMap(serverFactory -> serverFactory.getServers().stream())
                 .filter(AbstractConfigurableAsyncServer::isEnabled)
+                .filter(filters(request))
                 .forEach(Throwing.consumer(AbstractConfigurableAsyncServer::reloadSSLCertificate));
 
             return Responses.returnNoContent(response);
         });
     }
 
+    private Predicate<AbstractConfigurableAsyncServer> filters(Request request) {
+        Optional<Port> port = Optional.ofNullable(request.queryParams("port")).map(Integer::parseUnsignedInt).map(Port::of);
+
+        return server -> port.map(p -> server.getPort() == p.getValue()).orElse(true);
+    }
+
     private boolean noServerEnabled() {
         return servers.stream()
             .flatMap(serverFactory -> serverFactory.getServers().stream())


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


[james-project] 25/28: JAMES-3914 Sieve Reject: support several recipients

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit d5bad56ca55ec067e392f05f36e7b19fab6125de
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 16:26:04 2023 +0700

    JAMES-3914 Sieve Reject: support several recipients
---
 .../james/transport/mailets/jsieve/RejectAction.java  |  5 ++---
 .../mailets/delivery/SieveIntegrationTest.java        | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
index 9d0bdb7e59..32e3680404 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
@@ -109,8 +109,7 @@ public class RejectAction implements MailAction {
             originalRecipient = originalRecipients[0];
         }
 
-        MailAddress soleRecipient = ActionUtils.getSoleRecipient(aMail);
-        String finalRecipient = soleRecipient.asString();
+        String finalRecipient = context.getRecipient().asString();
         String originalMessageId = aMail.getMessage().getMessageID();
 
         Multipart multipart = MDN.builder()
@@ -133,7 +132,7 @@ public class RejectAction implements MailAction {
 
         // Send the message
         MimeMessage reply = (MimeMessage) aMail.getMessage().reply(false);
-        soleRecipient.toInternetAddress()
+        context.getRecipient().toInternetAddress()
             .ifPresent(Throwing.<Address>consumer(reply::setFrom).sneakyThrow());
         reply.setContent(multipart);
         reply.saveChanges();
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 47ede08af8..884dbfe606 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -479,6 +479,25 @@ class SieveIntegrationTest {
         assertThat(mail.getRecipients()).isEmpty();
     }
 
+    @Test
+    void rejectShouldWorkWhenMultipleRecipients() throws Exception {
+        prepareTestUsingScript("org/apache/james/transport/mailets/delivery/reject.script");
+        when(usersRepository.getUsername(new MailAddress("other@domain.tld"))).thenReturn(Username.of("other@domain.tld"));
+        when(resourceLocator.get(new MailAddress("other@domain.tld"))).thenThrow(new ScriptNotFoundException());
+
+        FakeMail mail = createMail();
+        mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
+        testee.service(mail);
+
+        FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
+            .recipient("sender@any.com")
+            .fromMailet()
+            .build();
+        assertThat(fakeMailContext.getSentMails())
+            .containsExactly(expectedSentMail);
+        assertThat(mail.getRecipients()).containsOnly(new MailAddress("other@domain.tld"));
+    }
+
     @Test
     void redirectShouldWorkWhenSeveralRecipients() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script");


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


[james-project] 21/28: JAMES-3914 Sieve FileIntoAction: support several recipients

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 1f67caf387d209da90509974547b140e3940055a
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 15:02:49 2023 +0700

    JAMES-3914 Sieve FileIntoAction: support several recipients
---
 .../transport/mailets/jsieve/FileIntoAction.java   | 25 +++++++++-------------
 .../mailets/delivery/SieveIntegrationTest.java     | 13 +++++++++++
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java
index a42c4e6f66..fe9a770840 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java
@@ -20,7 +20,6 @@ package org.apache.james.transport.mailets.jsieve;
 
 import javax.mail.MessagingException;
 
-import org.apache.james.core.MailAddress;
 import org.apache.jsieve.mail.Action;
 import org.apache.jsieve.mail.ActionFileInto;
 import org.apache.mailet.Mail;
@@ -64,26 +63,22 @@ public class FileIntoAction implements MailAction {
      * When IMAP support is added to James, it will be possible to support
      * sub-folders of <code>INBOX</code> fully.
      * </p>
-     * 
-     * @param anAction
-     * @param aMail
+     *
      * @param context not null
-     * @throws MessagingException
      */
     public void execute(ActionFileInto anAction, Mail aMail, final ActionContext context) throws MessagingException {
-        String destinationMailbox = anAction.getDestination();
-        MailAddress recipient;
-        recipient = ActionUtils.getSoleRecipient(aMail);
-
-        if (!(destinationMailbox.length() > 0
-            && destinationMailbox.charAt(0) == HIERARCHY_DELIMITER)) {
-            destinationMailbox =  HIERARCHY_DELIMITER + destinationMailbox;
-        }
-
+        String destinationMailbox = getDestinationMailbox(anAction);
         String mailbox = destinationMailbox.replace(HIERARCHY_DELIMITER, '/');
-        String url = "mailbox://" + recipient.asString() + mailbox;
+        String url = "mailbox://" + context.getRecipient().asString() + mailbox;
 
         context.post(url, aMail);
         LOGGER.debug("Filed Message ID: {} into destination: \"{}\"", aMail.getMessage().getMessageID(), destinationMailbox);
     }
+
+    private String getDestinationMailbox(ActionFileInto anAction) {
+        if (!(anAction.getDestination().length() > 0 && anAction.getDestination().charAt(0) == HIERARCHY_DELIMITER)) {
+            return HIERARCHY_DELIMITER + anAction.getDestination();
+        }
+        return anAction.getDestination();
+    }
 }
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index c2eeffbb95..029ccaf8b9 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -156,6 +156,19 @@ class SieveIntegrationTest {
         assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX_ANY);
     }
 
+    @Test
+    void shouldSupportSeveralRecipientsWhenFileInto() throws Exception {
+        prepareTestUsingScript("org/apache/james/transport/mailets/delivery/fileinto.script");
+        when(usersRepository.getUsername(new MailAddress("other@domain.tld"))).thenReturn(Username.of("other@domain.tld"));
+        when(resourceLocator.get(new MailAddress("other@domain.tld"))).thenThrow(new ScriptNotFoundException());
+
+        FakeMail mail = createMail();
+        mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
+        testee.service(mail);
+
+        assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX_ANY);
+    }
+
     @Test
     void allOfAllFalseScriptShouldWork() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/allofAllFalse.script");


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


[james-project] 10/28: [FIX] JPA blocking calls should be moved to bounded elastic

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit fab19c3df55bef1ab2044b9ff175ce58340b0ce9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jun 2 14:27:19 2023 +0700

    [FIX] JPA blocking calls should be moved to bounded elastic
---
 mailbox/jpa/pom.xml                                | 11 ++++++
 .../james/mailbox/jpa/mail/JPAMailboxMapper.java   | 20 +++++++---
 .../james/mailbox/jpa/mail/JPAMessageMapper.java   |  6 +++
 .../james/mailbox/store/StoreMailboxManager.java   |  2 +-
 .../james/mailbox/store/mail/AnnotationMapper.java | 27 +++++++++----
 .../james/mailbox/store/mail/MessageMapper.java    | 46 +++++++++++++---------
 .../james/mailbox/store/mail/ModSeqProvider.java   |  7 +++-
 .../james/mailbox/store/mail/UidProvider.java      |  7 +++-
 .../mailbox/store/user/SubscriptionMapper.java     | 12 ++++--
 mpt/impl/imap-mailbox/jpa/pom.xml                  |  3 ++
 server/apps/jpa-app/pom.xml                        |  3 ++
 .../jpa-app/sample-configuration/jvm.properties    |  3 +-
 server/apps/jpa-smtp-app/pom.xml                   | 13 ++++++
 .../sample-configuration/jvm.properties            |  3 +-
 server/apps/spring-app/pom.xml                     |  3 +-
 15 files changed, 124 insertions(+), 42 deletions(-)

diff --git a/mailbox/jpa/pom.xml b/mailbox/jpa/pom.xml
index 67b76c21f6..aae6618699 100644
--- a/mailbox/jpa/pom.xml
+++ b/mailbox/jpa/pom.xml
@@ -133,6 +133,17 @@
     </dependencies>
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>false</reuseForks>
+                    <forkCount>1</forkCount>
+                    <argLine>-Djava.library.path=
+                        -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec
+                        -Xms512m -Xmx1024m -Dopenjpa.Multithreaded=true</argLine>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.openjpa</groupId>
                 <artifactId>openjpa-maven-plugin</artifactId>
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
index f9c9f449a3..f691f5c1c3 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailbox.jpa.mail;
 
+import java.util.NoSuchElementException;
+
 import javax.persistence.EntityExistsException;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.NoResultException;
@@ -48,6 +50,7 @@ import com.google.common.base.Preconditions;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * Data access management for mailbox.
@@ -92,7 +95,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
                 getEntityManager().persist(persistedMailbox);
 
                 return new Mailbox(mailboxPath, uidValidity, persistedMailbox.getMailboxId());
-            }))
+            }).subscribeOn(Schedulers.boundedElastic()))
             .onErrorMap(PersistenceException.class, e -> new MailboxException("Save of mailbox " + mailboxPath.getName() + " failed", e));
     }
 
@@ -107,7 +110,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
 
                 getEntityManager().persist(persistedMailbox);
                 return (MailboxId) persistedMailbox.getMailboxId();
-            }))
+            }).subscribeOn(Schedulers.boundedElastic()))
             .onErrorMap(PersistenceException.class, e -> new MailboxException("Save of mailbox " + mailbox.getName() + " failed", e));
     }
 
@@ -133,12 +136,15 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
             .getSingleResult()
             .toMailbox())
             .onErrorResume(NoResultException.class, e -> Mono.empty())
-            .onErrorResume(PersistenceException.class, e -> Mono.error(new MailboxException("Exception upon JPA execution", e)));
+            .onErrorResume(NoSuchElementException.class, e -> Mono.empty())
+            .onErrorResume(PersistenceException.class, e -> Mono.error(new MailboxException("Exception upon JPA execution", e)))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     @Override
     public Mono<Mailbox> findMailboxById(MailboxId id) {
         return Mono.fromCallable(() -> loadJpaMailbox(id).toMailbox())
+            .subscribeOn(Schedulers.boundedElastic())
             .onErrorMap(PersistenceException.class, e -> new MailboxException("Search of mailbox " + id.serialize() + " failed", e));
     }
 
@@ -161,6 +167,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
             JPAMailbox jpaMailbox = getEntityManager().find(JPAMailbox.class, mailboxId.getRawId());
             getEntityManager().remove(jpaMailbox);
         })
+        .subscribeOn(Schedulers.boundedElastic())
         .onErrorMap(PersistenceException.class, e -> new MailboxException("Delete of mailbox " + mailbox + " failed", e))
         .then();
     }
@@ -169,6 +176,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
     public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) {
         String pathLike = MailboxExpressionBackwardCompatibility.getPathLike(query);
         return Mono.fromCallable(() -> findMailboxWithPathLikeTypedQuery(query.getFixedNamespace(), query.getFixedUser(), pathLike))
+            .subscribeOn(Schedulers.boundedElastic())
             .flatMapIterable(TypedQuery::getResultList)
             .map(JPAMailbox::toMailbox)
             .filter(query::matches)
@@ -192,6 +200,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
                 .setParameter("namespaceParam", mailbox.getNamespace())
                 .setParameter("userParam", mailbox.getUser().asString())
                 .getSingleResult()))
+            .subscribeOn(Schedulers.boundedElastic())
             .filter(numberOfChildMailboxes -> numberOfChildMailboxes > 0)
             .hasElement();
     }
@@ -199,6 +208,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
     @Override
     public Flux<Mailbox> list() {
         return Mono.fromCallable(() -> getEntityManager().createNamedQuery("listMailboxes", JPAMailbox.class))
+            .subscribeOn(Schedulers.boundedElastic())
             .flatMapIterable(TypedQuery::getResultList)
             .onErrorMap(PersistenceException.class, e -> new MailboxException("Delete of mailboxes failed", e))
             .map(JPAMailbox::toMailbox);
@@ -211,7 +221,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
             MailboxACL newACL = mailbox.getACL().apply(mailboxACLCommand);
             mailbox.setACL(newACL);
             return ACLDiff.computeDiff(oldACL, newACL);
-        });
+        }).subscribeOn(Schedulers.boundedElastic());
     }
 
     @Override
@@ -220,7 +230,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
             MailboxACL oldMailboxAcl = mailbox.getACL();
             mailbox.setACL(mailboxACL);
             return ACLDiff.computeDiff(oldMailboxAcl, mailboxACL);
-        });
+        }).subscribeOn(Schedulers.boundedElastic());
     }
 
     @Override
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
index da2b5fd2a4..e30765683b 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java
@@ -102,6 +102,12 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM
             .subscribeOn(Schedulers.boundedElastic());
     }
 
+    @Override
+    public Flux<MailboxMessage> findInMailboxReactive(Mailbox mailbox, MessageRange messageRange, FetchType ftype, int limitAsInt) {
+        return Flux.defer(Throwing.supplier(() -> Flux.fromIterable(findAsList(mailbox.getMailboxId(), messageRange, limitAsInt))).sneakyThrow())
+            .subscribeOn(Schedulers.boundedElastic());
+    }
+
     @Override
     public Iterator<MailboxMessage> findInMailbox(Mailbox mailbox, MessageRange set, FetchType fType, int max)
             throws MailboxException {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index d69ff57375..5c530d907f 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -578,7 +578,7 @@ public class StoreMailboxManager implements MailboxManager {
             return subscriptionMapper.findSubscriptionsForUserReactive(fromSession.getUser())
                 .collectList()
                 .flatMap(subscriptions -> Flux.fromIterable(renamedResults)
-                    .flatMap(renamedResult -> {
+                    .concatMap(renamedResult -> {
                         Function<Subscription, Mono<Void>> renameFunction = subscription -> subscriptionMapper.deleteReactive(subscription)
                             .then(subscriptionMapper.saveReactive(new Subscription(toSession.getUser(), renamedResult.getDestinationPath().asEscapedString())));
                         Subscription legacySubscription = new Subscription(fromSession.getUser(), renamedResult.getOriginPath().getName());
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AnnotationMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AnnotationMapper.java
index da3146fcc9..53d84bc651 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AnnotationMapper.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AnnotationMapper.java
@@ -30,6 +30,7 @@ import org.reactivestreams.Publisher;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 public interface AnnotationMapper extends Mapper {
     /**
@@ -42,7 +43,8 @@ public interface AnnotationMapper extends Mapper {
     List<MailboxAnnotation> getAllAnnotations(MailboxId mailboxId);
 
     default Publisher<MailboxAnnotation> getAllAnnotationsReactive(MailboxId mailboxId) {
-        return Flux.fromIterable(getAllAnnotations(mailboxId));
+        return Flux.fromIterable(getAllAnnotations(mailboxId))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -56,7 +58,8 @@ public interface AnnotationMapper extends Mapper {
     List<MailboxAnnotation> getAnnotationsByKeys(MailboxId mailboxId, Set<MailboxAnnotationKey> keys);
 
     default Publisher<MailboxAnnotation> getAnnotationsByKeysReactive(MailboxId mailboxId, Set<MailboxAnnotationKey> keys) {
-        return Flux.fromIterable(getAnnotationsByKeys(mailboxId, keys));
+        return Flux.fromIterable(getAnnotationsByKeys(mailboxId, keys))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -70,7 +73,8 @@ public interface AnnotationMapper extends Mapper {
     List<MailboxAnnotation> getAnnotationsByKeysWithOneDepth(MailboxId mailboxId, Set<MailboxAnnotationKey> keys);
 
     default Publisher<MailboxAnnotation> getAnnotationsByKeysWithOneDepthReactive(MailboxId mailboxId, Set<MailboxAnnotationKey> keys) {
-        return Flux.fromIterable(getAnnotationsByKeysWithOneDepth(mailboxId, keys));
+        return Flux.fromIterable(getAnnotationsByKeysWithOneDepth(mailboxId, keys))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -84,7 +88,8 @@ public interface AnnotationMapper extends Mapper {
     List<MailboxAnnotation> getAnnotationsByKeysWithAllDepth(MailboxId mailboxId, Set<MailboxAnnotationKey> keys);
 
     default Publisher<MailboxAnnotation> getAnnotationsByKeysWithAllDepthReactive(MailboxId mailboxId, Set<MailboxAnnotationKey> keys) {
-        return Flux.fromIterable(getAnnotationsByKeysWithAllDepth(mailboxId, keys));
+        return Flux.fromIterable(getAnnotationsByKeysWithAllDepth(mailboxId, keys))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -96,7 +101,9 @@ public interface AnnotationMapper extends Mapper {
     void deleteAnnotation(MailboxId mailboxId, MailboxAnnotationKey key);
 
     default Publisher<Void> deleteAnnotationReactive(MailboxId mailboxId, MailboxAnnotationKey key) {
-        return Mono.fromRunnable(() -> deleteAnnotation(mailboxId, key));
+        return Mono.fromRunnable(() -> deleteAnnotation(mailboxId, key))
+            .subscribeOn(Schedulers.boundedElastic())
+            .then();
     }
 
     /**
@@ -109,7 +116,9 @@ public interface AnnotationMapper extends Mapper {
     void insertAnnotation(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation);
 
     default Publisher<Void> insertAnnotationReactive(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation) {
-        return Mono.fromRunnable(() -> insertAnnotation(mailboxId, mailboxAnnotation));
+        return Mono.fromRunnable(() -> insertAnnotation(mailboxId, mailboxAnnotation))
+            .subscribeOn(Schedulers.boundedElastic())
+            .then();
     }
 
     /**
@@ -122,7 +131,8 @@ public interface AnnotationMapper extends Mapper {
     boolean exist(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation);
 
     default Publisher<Boolean> existReactive(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation) {
-        return Mono.fromCallable(() -> exist(mailboxId, mailboxAnnotation));
+        return Mono.fromCallable(() -> exist(mailboxId, mailboxAnnotation))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -132,6 +142,7 @@ public interface AnnotationMapper extends Mapper {
     int countAnnotations(MailboxId mailboxId);
 
     default Publisher<Integer> countAnnotationsReactive(MailboxId mailboxId) {
-        return Mono.fromCallable(() -> countAnnotations(mailboxId));
+        return Mono.fromCallable(() -> countAnnotations(mailboxId))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageMapper.java
index f37068826f..d87250c23e 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageMapper.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageMapper.java
@@ -51,6 +51,7 @@ import com.google.common.collect.ImmutableList;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * Maps {@link MailboxMessage} in a {@link org.apache.james.mailbox.MessageManager}. A {@link MessageMapper} has a lifecycle from the start of a request
@@ -97,11 +98,8 @@ public interface MessageMapper extends Mapper {
     List<MessageUid> retrieveMessagesMarkedForDeletion(Mailbox mailbox, MessageRange messageRange) throws MailboxException;
 
     default Flux<MessageUid> retrieveMessagesMarkedForDeletionReactive(Mailbox mailbox, MessageRange messageRange) {
-        try {
-            return Flux.fromIterable(retrieveMessagesMarkedForDeletion(mailbox, messageRange));
-        } catch (MailboxException e) {
-            return Flux.error(e);
-        }
+        return Flux.defer(Throwing.supplier(() -> Flux.fromIterable(retrieveMessagesMarkedForDeletion(mailbox, messageRange))).sneakyThrow())
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -113,7 +111,8 @@ public interface MessageMapper extends Mapper {
     MailboxCounters getMailboxCounters(Mailbox mailbox) throws MailboxException;
 
     default Mono<MailboxCounters> getMailboxCountersReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> getMailboxCounters(mailbox));
+        return Mono.fromCallable(() -> getMailboxCounters(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -128,7 +127,8 @@ public interface MessageMapper extends Mapper {
     Map<MessageUid, MessageMetaData> deleteMessages(Mailbox mailbox, List<MessageUid> uids) throws MailboxException;
 
     default Mono<Map<MessageUid, MessageMetaData>> deleteMessagesReactive(Mailbox mailbox, List<MessageUid> uids) {
-        return Mono.fromCallable(() -> deleteMessages(mailbox, uids));
+        return Mono.fromCallable(() -> deleteMessages(mailbox, uids))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -137,7 +137,8 @@ public interface MessageMapper extends Mapper {
     MessageUid findFirstUnseenMessageUid(Mailbox mailbox) throws MailboxException;
 
     default Mono<Optional<MessageUid>> findFirstUnseenMessageUidReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> Optional.ofNullable(findFirstUnseenMessageUid(mailbox)));
+        return Mono.fromCallable(() -> Optional.ofNullable(findFirstUnseenMessageUid(mailbox)))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -147,7 +148,8 @@ public interface MessageMapper extends Mapper {
     List<MessageUid> findRecentMessageUidsInMailbox(Mailbox mailbox) throws MailboxException;
 
     default Mono<List<MessageUid>> findRecentMessageUidsInMailboxReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> findRecentMessageUidsInMailbox(mailbox));
+        return Mono.fromCallable(() -> findRecentMessageUidsInMailbox(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
 
@@ -171,7 +173,8 @@ public interface MessageMapper extends Mapper {
             final MessageRange set) throws MailboxException;
 
     default Mono<List<UpdatedFlags>> updateFlagsReactive(Mailbox mailbox, FlagsUpdateCalculator flagsUpdateCalculator, MessageRange set) {
-        return Mono.fromCallable(() -> ImmutableList.copyOf(updateFlags(mailbox, flagsUpdateCalculator, set)));
+        return Mono.fromCallable(() -> (List<UpdatedFlags>) ImmutableList.copyOf(updateFlags(mailbox, flagsUpdateCalculator, set)))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     default Optional<UpdatedFlags> updateFlags(Mailbox mailbox, MessageUid uid, FlagsUpdateCalculator flagsUpdateCalculator) throws MailboxException {
@@ -193,7 +196,8 @@ public interface MessageMapper extends Mapper {
     }
 
     default Mono<List<UpdatedFlags>> resetRecentReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> resetRecent(mailbox));
+        return Mono.fromCallable(() -> resetRecent(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     
@@ -213,11 +217,13 @@ public interface MessageMapper extends Mapper {
     }
 
     default Mono<MessageMetaData> copyReactive(Mailbox mailbox, MailboxMessage original) {
-        return Mono.fromCallable(() -> copy(mailbox, original));
+        return Mono.fromCallable(() -> copy(mailbox, original))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     default Mono<List<MessageMetaData>> copyReactive(Mailbox mailbox, List<MailboxMessage> original) {
-        return Mono.fromCallable(() -> copy(mailbox, original));
+        return Mono.fromCallable(() -> copy(mailbox, original))
+            .subscribeOn(Schedulers.boundedElastic());
     }
     
     /**
@@ -236,12 +242,13 @@ public interface MessageMapper extends Mapper {
     }
 
     default Mono<MessageMetaData> moveReactive(Mailbox mailbox, MailboxMessage original) {
-        return Mono.fromCallable(() -> move(mailbox, original));
+        return Mono.fromCallable(() -> move(mailbox, original))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     default Mono<List<MessageMetaData>> moveReactive(Mailbox mailbox, List<MailboxMessage> original) {
         return Flux.fromIterable(original)
-            .flatMap(message -> moveReactive(mailbox, message), ReactorUtils.DEFAULT_CONCURRENCY)
+            .concatMap(message -> moveReactive(mailbox, message), ReactorUtils.DEFAULT_CONCURRENCY)
             .collectList();
     }
 
@@ -252,7 +259,8 @@ public interface MessageMapper extends Mapper {
     Optional<MessageUid> getLastUid(Mailbox mailbox) throws MailboxException;
 
     default Mono<Optional<MessageUid>> getLastUidReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> getLastUid(mailbox));
+        return Mono.fromCallable(() -> getLastUid(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -261,13 +269,15 @@ public interface MessageMapper extends Mapper {
     ModSeq getHighestModSeq(Mailbox mailbox) throws MailboxException;
 
     default Mono<ModSeq> getHighestModSeqReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> getHighestModSeq(mailbox));
+        return Mono.fromCallable(() -> getHighestModSeq(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     Flags getApplicableFlag(Mailbox mailbox) throws MailboxException;
 
     default Mono<Flags> getApplicableFlagReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> getApplicableFlag(mailbox));
+        return Mono.fromCallable(() -> getApplicableFlag(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ModSeqProvider.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ModSeqProvider.java
index 84b0a0f76d..f1af829383 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ModSeqProvider.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ModSeqProvider.java
@@ -24,6 +24,7 @@ import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MailboxId;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * Take care of provide mod-seqences for a given {@link Mailbox}. Be aware that implementations
@@ -55,7 +56,8 @@ public interface ModSeqProvider {
     ModSeq highestModSeq(Mailbox mailbox) throws MailboxException;
 
     default Mono<ModSeq> highestModSeqReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> highestModSeq(mailbox));
+        return Mono.fromCallable(() -> highestModSeq(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -64,6 +66,7 @@ public interface ModSeqProvider {
     ModSeq highestModSeq(MailboxId mailboxId) throws MailboxException;
 
     default Mono<ModSeq> nextModSeqReactive(MailboxId mailboxId) {
-        return Mono.fromCallable(() -> nextModSeq(mailboxId));
+        return Mono.fromCallable(() -> nextModSeq(mailboxId))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/UidProvider.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/UidProvider.java
index 18f8a22db0..f4e516772d 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/UidProvider.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/UidProvider.java
@@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableList;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * Take care of provide uids for a given {@link Mailbox}. Be aware that implementations
@@ -50,13 +51,15 @@ public interface UidProvider {
     Optional<MessageUid> lastUid(Mailbox mailbox) throws MailboxException;
 
     default Mono<Optional<MessageUid>> lastUidReactive(Mailbox mailbox) {
-        return Mono.fromCallable(() -> lastUid(mailbox));
+        return Mono.fromCallable(() -> lastUid(mailbox))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     MessageUid nextUid(MailboxId mailboxId) throws MailboxException;
 
     default Mono<MessageUid> nextUidReactive(MailboxId mailboxId) {
-        return Mono.fromCallable(() -> nextUid(mailboxId));
+        return Mono.fromCallable(() -> nextUid(mailboxId))
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     default Mono<List<MessageUid>> nextUids(MailboxId mailboxId, int count) {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java
index 6f0f233d95..78b789cd5c 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java
@@ -30,6 +30,7 @@ import com.google.common.base.Functions;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * Mapper for {@link Subscription}
@@ -43,7 +44,9 @@ public interface SubscriptionMapper extends Mapper {
     void save(Subscription subscription) throws SubscriptionException;
 
     default Mono<Void> saveReactive(Subscription subscription) {
-        return Mono.fromRunnable(Throwing.runnable(() -> save(subscription)));
+        return Mono.fromRunnable(Throwing.runnable(() -> save(subscription)))
+            .subscribeOn(Schedulers.boundedElastic())
+            .then();
     }
 
     /**
@@ -55,7 +58,8 @@ public interface SubscriptionMapper extends Mapper {
 
     default Flux<Subscription> findSubscriptionsForUserReactive(Username user) {
         return Mono.fromCallable(() -> findSubscriptionsForUser(user))
-            .flatMapIterable(Functions.identity());
+            .flatMapIterable(Functions.identity())
+            .subscribeOn(Schedulers.boundedElastic());
     }
 
     /**
@@ -65,6 +69,8 @@ public interface SubscriptionMapper extends Mapper {
     void delete(Subscription subscription) throws SubscriptionException;
 
     default Mono<Void> deleteReactive(Subscription subscription) {
-        return Mono.fromRunnable(Throwing.runnable(() -> delete(subscription)));
+        return Mono.fromRunnable(Throwing.runnable(() -> delete(subscription)))
+            .subscribeOn(Schedulers.boundedElastic())
+            .then();
     }
 }
\ No newline at end of file
diff --git a/mpt/impl/imap-mailbox/jpa/pom.xml b/mpt/impl/imap-mailbox/jpa/pom.xml
index a966c5b94c..2c5858c036 100644
--- a/mpt/impl/imap-mailbox/jpa/pom.xml
+++ b/mpt/impl/imap-mailbox/jpa/pom.xml
@@ -104,6 +104,9 @@
                 <configuration>
                     <reuseForks>true</reuseForks>
                     <forkCount>1C</forkCount>
+                    <argLine>-Djava.library.path=
+                        -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec
+                        -Xms512m -Xmx1024m -Dopenjpa.Multithreaded=true</argLine>
                 </configuration>
             </plugin>
         </plugins>
diff --git a/server/apps/jpa-app/pom.xml b/server/apps/jpa-app/pom.xml
index a5619aba62..0c782039ca 100644
--- a/server/apps/jpa-app/pom.xml
+++ b/server/apps/jpa-app/pom.xml
@@ -357,6 +357,9 @@
                     <reuseForks>false</reuseForks>
                     <!-- Speed up a bit things -->
                     <forkCount>1C</forkCount>
+                    <argLine>-Djava.library.path=
+                        -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec
+                        -Xms512m -Xmx1024m -Dopenjpa.Multithreaded=true</argLine>
                 </configuration>
             </plugin>
             <plugin>
diff --git a/server/apps/jpa-app/sample-configuration/jvm.properties b/server/apps/jpa-app/sample-configuration/jvm.properties
index 99175bbd68..73b964c9b4 100644
--- a/server/apps/jpa-app/sample-configuration/jvm.properties
+++ b/server/apps/jpa-app/sample-configuration/jvm.properties
@@ -49,4 +49,5 @@ james.jmx.credential.generation=true
 
 # Disable Remote Code Execution feature from JMX
 # CF https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/19fb8f93c59dfd791f62d41f332db9e306bc1422/src/java.management/share/classes/com/sun/jmx/remote/security/MBeanServerAccessController.java#L646
-jmx.remote.x.mlet.allow.getMBeansFromURL=false
\ No newline at end of file
+jmx.remote.x.mlet.allow.getMBeansFromURL=false
+openjpa.Multithreaded=true
\ No newline at end of file
diff --git a/server/apps/jpa-smtp-app/pom.xml b/server/apps/jpa-smtp-app/pom.xml
index 131d6c20e3..d9421baefe 100644
--- a/server/apps/jpa-smtp-app/pom.xml
+++ b/server/apps/jpa-smtp-app/pom.xml
@@ -234,6 +234,19 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <!-- Isolation issues with Derby inMemory database -->
+                    <reuseForks>false</reuseForks>
+                    <!-- Speed up a bit things -->
+                    <forkCount>1C</forkCount>
+                    <argLine>-Djava.library.path=
+                        -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec
+                        -Xms512m -Xmx1024m -Dopenjpa.Multithreaded=true</argLine>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>com.google.cloud.tools</groupId>
                 <artifactId>jib-maven-plugin</artifactId>
diff --git a/server/apps/jpa-smtp-app/sample-configuration/jvm.properties b/server/apps/jpa-smtp-app/sample-configuration/jvm.properties
index 99175bbd68..73b964c9b4 100644
--- a/server/apps/jpa-smtp-app/sample-configuration/jvm.properties
+++ b/server/apps/jpa-smtp-app/sample-configuration/jvm.properties
@@ -49,4 +49,5 @@ james.jmx.credential.generation=true
 
 # Disable Remote Code Execution feature from JMX
 # CF https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/19fb8f93c59dfd791f62d41f332db9e306bc1422/src/java.management/share/classes/com/sun/jmx/remote/security/MBeanServerAccessController.java#L646
-jmx.remote.x.mlet.allow.getMBeansFromURL=false
\ No newline at end of file
+jmx.remote.x.mlet.allow.getMBeansFromURL=false
+openjpa.Multithreaded=true
\ No newline at end of file
diff --git a/server/apps/spring-app/pom.xml b/server/apps/spring-app/pom.xml
index efdc369407..0a1bb9759a 100644
--- a/server/apps/spring-app/pom.xml
+++ b/server/apps/spring-app/pom.xml
@@ -70,7 +70,8 @@
         <james.system-property1>-Djames.message.usememorycopy=false</james.system-property1>
         <!-- Prevents Logjam (CVE-2015-4000) -->
         <james.system-property2>-Djdk.tls.ephemeralDHKeySize=2048</james.system-property2>
-        <james.system-properties>${james.system-property1} ${james.system-property2}</james.system-properties>
+        <james.system-property3>-openjpa.Multithreaded=true</james.system-property3>
+        <james.system-properties>${james.system-property1} ${james.system-property2} ${james.system-property3}</james.system-properties>
         <!-- this name is used for James's folders on Debian systems and james user -->
         <james.debian.user>apache-james</james.debian.user>
 


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


[james-project] 03/28: [FIX] Correctly close JPA EntityManager in a couple of places (#1574)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e0e6f24bd0563d9a556c7ed8cd60dd984d0cb556
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Tue May 30 08:56:18 2023 +0700

    [FIX] Correctly close JPA EntityManager in a couple of places (#1574)
---
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java   | 73 +++++++++++++++-------
 .../mailbox/jpa/quota/JpaCurrentQuotaManager.java  | 10 ++-
 .../james/jpa/healthcheck/JPAHealthCheck.java      | 17 ++---
 3 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
index dcd23bae35..fa1fcffaca 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
+import org.apache.james.backends.jpa.EntityManagerUtils;
 import org.apache.james.backends.jpa.TransactionRunner;
 import org.apache.james.core.Domain;
 import org.apache.james.core.quota.QuotaCountLimit;
@@ -163,56 +164,80 @@ public class JPAPerUserMaxQuotaDAO {
 
     public Optional<QuotaSizeLimit> getGlobalMaxStorage() {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY);
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY);
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaSize(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaSize(storedValue.getValue());
     }
 
     public Optional<QuotaCountLimit> getGlobalMaxMessage() {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY);
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY);
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaCount(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaCount(storedValue.getValue());
     }
 
     public Optional<QuotaSizeLimit> getMaxStorage(QuotaRoot quotaRoot) {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue());
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue());
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaSize(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaSize(storedValue.getValue());
     }
 
     public Optional<QuotaCountLimit> getMaxMessage(QuotaRoot quotaRoot) {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue());
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue());
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaCount(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaCount(storedValue.getValue());
     }
 
     public Optional<QuotaCountLimit> getDomainMaxMessage(Domain domain) {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxDomainMessageCount storedValue = entityManager.find(MaxDomainMessageCount.class, domain.asString());
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxDomainMessageCount storedValue = entityManager.find(MaxDomainMessageCount.class, domain.asString());
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaCount(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaCount(storedValue.getValue());
     }
 
     public Optional<QuotaSizeLimit> getDomainMaxStorage(Domain domain) {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
-        MaxDomainStorage storedValue = entityManager.find(MaxDomainStorage.class, domain.asString());
-        if (storedValue == null) {
-            return Optional.empty();
+        try {
+            MaxDomainStorage storedValue = entityManager.find(MaxDomainStorage.class, domain.asString());
+            if (storedValue == null) {
+                return Optional.empty();
+            }
+            return longToQuotaSize(storedValue.getValue());
+        } finally {
+            EntityManagerUtils.safelyClose(entityManager);
         }
-        return longToQuotaSize(storedValue.getValue());
     }
 
 
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
index 3e4c6d161a..2f5c5a980d 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
@@ -25,6 +25,7 @@ import javax.inject.Inject;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
+import org.apache.james.backends.jpa.EntityManagerUtils;
 import org.apache.james.backends.jpa.TransactionRunner;
 import org.apache.james.core.quota.QuotaCountUsage;
 import org.apache.james.core.quota.QuotaSizeUsage;
@@ -56,7 +57,8 @@ public class JpaCurrentQuotaManager implements CurrentQuotaManager {
 
         return Mono.fromCallable(() -> Optional.ofNullable(retrieveUserQuota(entityManager, quotaRoot))
             .map(JpaCurrentQuota::getMessageCount)
-            .orElse(QuotaCountUsage.count(NO_STORED_BYTES)));
+            .orElse(QuotaCountUsage.count(NO_STORED_BYTES)))
+            .doFinally(any -> EntityManagerUtils.safelyClose(entityManager));
     }
 
     @Override
@@ -65,14 +67,16 @@ public class JpaCurrentQuotaManager implements CurrentQuotaManager {
 
         return Mono.fromCallable(() -> Optional.ofNullable(retrieveUserQuota(entityManager, quotaRoot))
             .map(JpaCurrentQuota::getSize)
-            .orElse(QuotaSizeUsage.size(NO_STORED_BYTES)));
+            .orElse(QuotaSizeUsage.size(NO_STORED_BYTES)))
+            .doFinally(any -> EntityManagerUtils.safelyClose(entityManager));
     }
 
     public Mono<CurrentQuotas> getCurrentQuotas(QuotaRoot quotaRoot) {
         EntityManager entityManager = entityManagerFactory.createEntityManager();
         return Mono.fromCallable(() ->  Optional.ofNullable(retrieveUserQuota(entityManager, quotaRoot))
             .map(jpaCurrentQuota -> new CurrentQuotas(jpaCurrentQuota.getMessageCount(), jpaCurrentQuota.getSize()))
-            .orElse(CurrentQuotas.emptyQuotas()));
+            .orElse(CurrentQuotas.emptyQuotas()))
+            .doFinally(any -> EntityManagerUtils.safelyClose(entityManager));
     }
 
     @Override
diff --git a/server/data/data-jpa/src/main/java/org/apache/james/jpa/healthcheck/JPAHealthCheck.java b/server/data/data-jpa/src/main/java/org/apache/james/jpa/healthcheck/JPAHealthCheck.java
index a97461223a..7dbea33e7f 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/jpa/healthcheck/JPAHealthCheck.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/jpa/healthcheck/JPAHealthCheck.java
@@ -22,14 +22,15 @@ import static org.apache.james.core.healthcheck.Result.healthy;
 import static org.apache.james.core.healthcheck.Result.unhealthy;
 
 import javax.inject.Inject;
-import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
+import org.apache.james.backends.jpa.EntityManagerUtils;
 import org.apache.james.core.healthcheck.ComponentName;
 import org.apache.james.core.healthcheck.HealthCheck;
 import org.apache.james.core.healthcheck.Result;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 public class JPAHealthCheck implements HealthCheck {
 
@@ -47,15 +48,15 @@ public class JPAHealthCheck implements HealthCheck {
 
     @Override
     public Mono<Result> check() {
-        return Mono.fromCallable(entityManagerFactory::createEntityManager)
-            .map(EntityManager::isOpen)
-            .map(open -> {
-                if (open) {
-                    return healthy(componentName());
+        return Mono.usingWhen(Mono.fromCallable(entityManagerFactory::createEntityManager).subscribeOn(Schedulers.boundedElastic()),
+            entityManager -> {
+                if (entityManager.isOpen()) {
+                    return Mono.just(healthy(componentName()));
                 } else {
-                    return unhealthy(componentName(), "entityManager is not open");
+                    return Mono.just(unhealthy(componentName(), "entityManager is not open"));
                 }
-            })
+            },
+            entityManager -> Mono.fromRunnable(() -> EntityManagerUtils.safelyClose(entityManager)).subscribeOn(Schedulers.boundedElastic()))
             .onErrorResume(IllegalStateException.class,
                 e -> Mono.just(unhealthy(componentName(), "EntityManagerFactory or EntityManager thrown an IllegalStateException, the connection is unhealthy", e)))
             .onErrorResume(e -> Mono.just(unhealthy(componentName(), "Unexpected exception upon checking JPA driver", e)));


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


[james-project] 13/28: JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit ffff162dc00a4083d4c7882be61131d0fa85186f
Author: Wojciech Kapcia <wo...@tigase.org>
AuthorDate: Thu May 11 19:06:39 2023 -0400

    JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
---
 .../org/apache/james/modules/protocols/ManageSieveServerModule.java     | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
index 9ec6101d8e..cd10b994f2 100644
--- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -35,6 +35,7 @@ import org.apache.james.utils.KeystoreCreator;
 import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
 import com.google.inject.multibindings.Multibinder;
 import com.google.inject.multibindings.ProvidesIntoSet;
 
@@ -43,6 +44,7 @@ public class ManageSieveServerModule extends AbstractModule {
     @Override
     protected void configure() {
         install(new SieveModule());
+        bind(ManageSieveServerFactory.class).in(Scopes.SINGLETON);
         bind(CoreCommands.class).to(CoreProcessor.class);
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class);
 


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


[james-project] 16/28: JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4d360f65a0ba1858c16ee8aa32a0c29b9471d1f0
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu May 25 11:19:47 2023 +0700

    JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management
---
 pom.xml                                            |  5 ++
 .../james/modules/protocols/IMAPServerModule.java  |  5 +-
 .../james/modules/protocols/LMTPServerModule.java  |  5 +-
 .../modules/protocols/ManageSieveServerModule.java |  5 +-
 .../james/modules/protocols/POP3ServerModule.java  |  5 +-
 .../james/modules/protocols/SMTPServerModule.java  |  5 +-
 server/container/guice/protocols/webadmin/pom.xml  |  4 ++
 .../james/modules/server/ServerRouteModule.java}   | 30 ++++----
 .../james/modules/server/WebAdminServerModule.java |  7 +-
 server/protocols/protocols-library/pom.xml         |  4 --
 .../lib/webadmin/AbstractServerRoutes.java         | 42 -----------
 .../james/lmtpserver/webadmin/LMTPRoutes.java      | 21 ------
 .../webadmin/ManageSieveRoutes.java                | 21 ------
 .../james/pop3server/webadmin/POP3Routes.java      | 21 ------
 .../james/smtpserver/webadmin/SmtpRoutes.java      | 21 ------
 server/protocols/webadmin/pom.xml                  |  1 +
 .../webadmin/webadmin-protocols}/pom.xml           | 31 +++++----
 .../protocols/webadmin/ProtocolServerRoutes.java   | 81 ++++++++++++++++++++++
 18 files changed, 133 insertions(+), 181 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5abb95fa18..ad6608245f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1938,6 +1938,11 @@
                 <artifactId>james-server-webadmin-mailrepository</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-webadmin-protocols</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-webadmin-rabbitmq</artifactId>
diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
index 0d84991d97..603fdc7a15 100644
--- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
+++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
@@ -57,10 +57,10 @@ import org.apache.james.imap.processor.SelectProcessor;
 import org.apache.james.imap.processor.base.AbstractProcessor;
 import org.apache.james.imap.processor.base.UnknownRequestProcessor;
 import org.apache.james.imapserver.netty.IMAPServerFactory;
-import org.apache.james.imapserver.webadmin.ImapRoutes;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.metrics.api.GaugeRegistry;
 import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.utils.ClassName;
 import org.apache.james.utils.GuiceGenericLoader;
@@ -68,7 +68,6 @@ import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
-import org.apache.james.webadmin.Routes;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.ImmutableList;
@@ -102,7 +101,7 @@ public class IMAPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ImapRoutes.class);
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(IMAPServerFactory.class);
     }
 
     @Provides
diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
index 168d2f7027..9e198cf843 100644
--- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
+++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
@@ -24,14 +24,13 @@ import org.apache.james.RunArguments;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.lmtpserver.netty.LMTPServerFactory;
-import org.apache.james.lmtpserver.webadmin.LMTPRoutes;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
-import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -45,7 +44,7 @@ public class LMTPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(LmtpGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(LMTPRoutes.class);
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(LMTPServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
index cd10b994f2..9f62812d45 100644
--- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -25,14 +25,13 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.managesieve.api.commands.CoreCommands;
 import org.apache.james.managesieve.core.CoreProcessor;
 import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
-import org.apache.james.managesieveserver.webadmin.ManageSieveRoutes;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.util.LoggingLevel;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
-import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -48,7 +47,7 @@ public class ManageSieveServerModule extends AbstractModule {
         bind(CoreCommands.class).to(CoreProcessor.class);
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class);
 
-        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ManageSieveRoutes.class);
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(ManageSieveServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
index e22859ff34..75bfc62949 100644
--- a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
+++ b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
@@ -26,13 +26,12 @@ import org.apache.james.lifecycle.api.ConfigurationSanitizer;
 import org.apache.james.pop3server.mailbox.DefaultMailboxAdapterFactory;
 import org.apache.james.pop3server.mailbox.MailboxAdapterFactory;
 import org.apache.james.pop3server.netty.POP3ServerFactory;
-import org.apache.james.pop3server.webadmin.POP3Routes;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
-import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -49,7 +48,7 @@ public class POP3ServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(Pop3GuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(POP3Routes.class);
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(POP3ServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
index 8ba9378900..b3b8dcd3b2 100644
--- a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
@@ -23,15 +23,14 @@ import org.apache.james.ProtocolConfigurationSanitizer;
 import org.apache.james.RunArguments;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.ConfigurationSanitizer;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
 import org.apache.james.server.core.configuration.ConfigurationProvider;
 import org.apache.james.smtpserver.SendMailHandler;
 import org.apache.james.smtpserver.netty.SMTPServerFactory;
-import org.apache.james.smtpserver.webadmin.SmtpRoutes;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.InitializationOperation;
 import org.apache.james.utils.InitilizationOperationBuilder;
 import org.apache.james.utils.KeystoreCreator;
-import org.apache.james.webadmin.Routes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
@@ -46,7 +45,7 @@ public class SMTPServerModule extends AbstractModule {
 
         Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SmtpGuiceProbe.class);
 
-        Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(SmtpRoutes.class);
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(SMTPServerFactory.class);
     }
 
     @ProvidesIntoSet
diff --git a/server/container/guice/protocols/webadmin/pom.xml b/server/container/guice/protocols/webadmin/pom.xml
index d59a0e8923..68540f10e9 100644
--- a/server/container/guice/protocols/webadmin/pom.xml
+++ b/server/container/guice/protocols/webadmin/pom.xml
@@ -49,6 +49,10 @@
             <artifactId>james-server-webadmin-dropwizard-metrics</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-protocols</artifactId>
+        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/ServerRouteModule.java
similarity index 67%
rename from server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
rename to server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/ServerRouteModule.java
index 77cb9375f8..a8c20b902f 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java
+++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/ServerRouteModule.java
@@ -16,25 +16,23 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.webadmin;
 
-import javax.inject.Inject;
+package org.apache.james.modules.server;
 
-import org.apache.james.imapserver.netty.IMAPServerFactory;
-import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.protocols.webadmin.ProtocolServerRoutes;
+import org.apache.james.webadmin.Routes;
 
-public class ImapRoutes
-        extends AbstractServerRoutes {
-
-    public static final String BASE_PATH = "/imap";
-
-    @Inject
-    public ImapRoutes(IMAPServerFactory imapServerFactory) {
-        this.serverFactory = imapServerFactory;
-    }
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
 
+public class ServerRouteModule extends AbstractModule {
     @Override
-    public String getBasePath() {
-        return BASE_PATH;
+    protected void configure() {
+        Multibinder.newSetBinder(binder(), AbstractServerFactory.class);
+
+        Multibinder.newSetBinder(binder(), Routes.class)
+            .addBinding()
+            .to(ProtocolServerRoutes.class);
     }
-}
\ No newline at end of file
+}
diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 43b7c26a25..a050be1011 100644
--- a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -68,7 +68,6 @@ import org.slf4j.LoggerFactory;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableList;
 import com.google.inject.AbstractModule;
 import com.google.inject.Provider;
@@ -79,8 +78,8 @@ import com.google.inject.multibindings.Multibinder;
 import com.google.inject.multibindings.ProvidesIntoSet;
 
 public class WebAdminServerModule extends AbstractModule {
-
     private static final Logger LOGGER = LoggerFactory.getLogger(WebAdminServerModule.class);
+
     private static final boolean DEFAULT_JWT_DISABLED = false;
     private static final boolean DEFAULT_DISABLED = false;
     private static final String DEFAULT_NO_CORS_ORIGIN = null;
@@ -90,14 +89,12 @@ public class WebAdminServerModule extends AbstractModule {
     private static final String DEFAULT_NO_PASSWORD = null;
     private static final String DEFAULT_NO_TRUST_KEYSTORE = null;
     private static final String DEFAULT_NO_TRUST_PASSWORD = null;
-    private static final Splitter SPLITTER = Splitter.on(',')
-        .trimResults()
-        .omitEmptyStrings();
 
     @Override
     protected void configure() {
         install(new TaskRoutesModule());
         install(new HealthCheckRoutesModule());
+        install(new ServerRouteModule());
 
         bind(JsonTransformer.class).in(Scopes.SINGLETON);
         bind(WebAdminServer.class).in(Scopes.SINGLETON);
diff --git a/server/protocols/protocols-library/pom.xml b/server/protocols/protocols-library/pom.xml
index c527fe454d..ffda3f0739 100644
--- a/server/protocols/protocols-library/pom.xml
+++ b/server/protocols/protocols-library/pom.xml
@@ -52,10 +52,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-webadmin-core</artifactId>
-        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>metrics-api</artifactId>
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java
deleted file mode 100644
index baaa2d4606..0000000000
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/webadmin/AbstractServerRoutes.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.james.protocols.lib.webadmin;
-
-import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
-import org.apache.james.protocols.lib.netty.AbstractServerFactory;
-import org.apache.james.webadmin.Routes;
-import org.apache.james.webadmin.utils.ErrorResponder;
-import org.apache.james.webadmin.utils.Responses;
-import org.eclipse.jetty.http.HttpStatus;
-
-import com.google.common.base.Preconditions;
-
-import spark.Service;
-
-public abstract class AbstractServerRoutes
-        implements Routes {
-
-    protected AbstractServerFactory serverFactory;
-
-    @Override
-    public void define(Service service) {
-        service.post(getBasePath(), (request, response) -> {
-            Preconditions.checkArgument(request.queryParams().contains("reload-certificate"),
-                    "'reload-certificate' query parameter shall be specified");
-
-            if (serverFactory.getServers() == null
-                    || serverFactory.getServers().isEmpty()
-                    || serverFactory.getServers().stream().noneMatch(AbstractConfigurableAsyncServer::isEnabled)) {
-                return ErrorResponder.builder()
-                        .statusCode(HttpStatus.BAD_REQUEST_400)
-                        .type(ErrorResponder.ErrorType.NOT_FOUND)
-                        .message("No servers configured, nothing to reload")
-                        .haltError();
-            }
-
-            for (AbstractConfigurableAsyncServer server : serverFactory.getServers()) {
-                server.reloadSSLCertificate();
-            }
-
-            return Responses.returnNoContent(response);
-        });
-    }
-}
\ No newline at end of file
diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java
deleted file mode 100644
index ac949aad95..0000000000
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/webadmin/LMTPRoutes.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.james.lmtpserver.webadmin;
-
-import javax.inject.Inject;
-
-import org.apache.james.lmtpserver.netty.LMTPServerFactory;
-import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
-
-public class LMTPRoutes extends AbstractServerRoutes {
-
-    public static final String BASE_PATH = "/lmtp";
-
-    @Inject
-    public LMTPRoutes(LMTPServerFactory lmtpServerFactory) {
-        this.serverFactory = lmtpServerFactory;
-    }
-
-    @Override
-    public String getBasePath() {
-        return BASE_PATH;
-    }
-}
\ No newline at end of file
diff --git a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java
deleted file mode 100644
index 6aa01b7b27..0000000000
--- a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/webadmin/ManageSieveRoutes.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.james.managesieveserver.webadmin;
-
-import javax.inject.Inject;
-
-import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
-import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
-
-public class ManageSieveRoutes extends AbstractServerRoutes {
-
-    public static final String BASE_PATH = "/sieve";
-
-    @Inject
-    public ManageSieveRoutes(ManageSieveServerFactory manageSieveServerFactory) {
-        this.serverFactory = manageSieveServerFactory;
-    }
-
-    @Override
-    public String getBasePath() {
-        return BASE_PATH;
-    }
-}
\ No newline at end of file
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java
deleted file mode 100644
index 7e41923ea4..0000000000
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/webadmin/POP3Routes.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.james.pop3server.webadmin;
-
-import javax.inject.Inject;
-
-import org.apache.james.pop3server.netty.POP3ServerFactory;
-import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
-
-public class POP3Routes extends AbstractServerRoutes {
-
-    public static final String BASE_PATH = "/pop3";
-
-    @Inject
-    public POP3Routes(POP3ServerFactory pop3ServerFactory) {
-        this.serverFactory = pop3ServerFactory;
-    }
-
-    @Override
-    public String getBasePath() {
-        return BASE_PATH;
-    }
-}
\ No newline at end of file
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java
deleted file mode 100644
index 79d409cc86..0000000000
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/webadmin/SmtpRoutes.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.apache.james.smtpserver.webadmin;
-
-import javax.inject.Inject;
-
-import org.apache.james.protocols.lib.webadmin.AbstractServerRoutes;
-import org.apache.james.smtpserver.netty.SMTPServerFactory;
-
-public class SmtpRoutes extends AbstractServerRoutes {
-
-    public static final String BASE_PATH = "/smtp";
-
-    @Inject
-    public SmtpRoutes(SMTPServerFactory imapServerFactory) {
-        this.serverFactory = imapServerFactory;
-    }
-
-    @Override
-    public String getBasePath() {
-        return BASE_PATH;
-    }
-}
\ No newline at end of file
diff --git a/server/protocols/webadmin/pom.xml b/server/protocols/webadmin/pom.xml
index 1cb51e1bc8..bb154b701e 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -46,6 +46,7 @@
         <module>webadmin-mailqueue</module>
         <module>webadmin-mailrepository</module>
         <module>webadmin-pop3</module>
+        <module>webadmin-protocols</module>
         <module>webadmin-rabbitmq</module>
     </modules>
 
diff --git a/server/container/guice/protocols/webadmin/pom.xml b/server/protocols/webadmin/webadmin-protocols/pom.xml
similarity index 72%
copy from server/container/guice/protocols/webadmin/pom.xml
copy to server/protocols/webadmin/webadmin-protocols/pom.xml
index d59a0e8923..6efb578656 100644
--- a/server/container/guice/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/webadmin-protocols/pom.xml
@@ -7,9 +7,7 @@
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License. You may obtain a copy of the License at
-
     http://www.apache.org/licenses/LICENSE-2.0
-
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -18,36 +16,38 @@
     under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.james</groupId>
-        <artifactId>james-server-guice</artifactId>
+        <artifactId>james-server</artifactId>
         <version>3.8.1-SNAPSHOT</version>
-        <relativePath>../../pom.xml</relativePath>
+        <relativePath>../../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>james-server-guice-webadmin</artifactId>
-
-    <name>Apache James :: Server :: Guice :: Webadmin</name>
-    <description>Webadmin modules for Guice implementation of James server</description>
+    <artifactId>james-server-webadmin-protocols</artifactId>
+    <name>Apache James :: Server :: WebAdmin :: POP3</name>
+    <description>Finner grained management for protocols</description>
 
     <dependencies>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-guice-configuration</artifactId>
+            <artifactId>james-server-protocols-library</artifactId>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-guice-utils</artifactId>
+            <artifactId>james-server-webadmin-core</artifactId>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>james-server-webadmin-core</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-webadmin-dropwizard-metrics</artifactId>
-            <version>${project.version}</version>
+            <artifactId>metrics-tests</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
@@ -55,8 +55,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
-</project>
+</project>
\ No newline at end of file
diff --git a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
new file mode 100644
index 0000000000..4dabb780c1
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java
@@ -0,0 +1,81 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.protocols.webadmin;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
+import org.apache.james.protocols.lib.netty.AbstractServerFactory;
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.utils.ErrorResponder;
+import org.apache.james.webadmin.utils.Responses;
+import org.eclipse.jetty.http.HttpStatus;
+
+import com.github.fge.lambdas.Throwing;
+import com.google.common.base.Preconditions;
+
+import spark.Service;
+
+public class ProtocolServerRoutes implements Routes {
+    public static final String SERVERS = "servers";
+
+    private final Set<AbstractServerFactory> servers;
+
+    @Inject
+    public ProtocolServerRoutes(Set<AbstractServerFactory> servers) {
+        this.servers = servers;
+    }
+
+    @Override
+    public String getBasePath() {
+        return SERVERS;
+    }
+
+    @Override
+    public void define(Service service) {
+        service.post(SERVERS, (request, response) -> {
+            Preconditions.checkArgument(request.queryParams().contains("reload-certificate"),
+                "'reload-certificate' query parameter shall be specified");
+
+            if (noServerEnabled()) {
+                return ErrorResponder.builder()
+                    .statusCode(HttpStatus.BAD_REQUEST_400)
+                    .type(ErrorResponder.ErrorType.NOT_FOUND)
+                    .message("No servers configured, nothing to reload")
+                    .haltError();
+            }
+
+            servers.stream()
+                .flatMap(serverFactory -> serverFactory.getServers().stream())
+                .filter(AbstractConfigurableAsyncServer::isEnabled)
+                .forEach(Throwing.consumer(AbstractConfigurableAsyncServer::reloadSSLCertificate));
+
+            return Responses.returnNoContent(response);
+        });
+    }
+
+    private boolean noServerEnabled() {
+        return servers.stream()
+            .flatMap(serverFactory -> serverFactory.getServers().stream())
+            .filter(AbstractConfigurableAsyncServer::isEnabled).findFirst().isEmpty();
+    }
+}


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


[james-project] 04/28: [FIX] Update JPA version in demo container (#1576)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 3aee16ab1820923215fcbb5348e4684e2739e0e8
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Jun 1 16:50:29 2023 +0700

    [FIX] Update JPA version in demo container (#1576)
---
 server/apps/demo/startup.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/apps/demo/startup.sh b/server/apps/demo/startup.sh
index 2a8510fd76..04f3aaa9b9 100644
--- a/server/apps/demo/startup.sh
+++ b/server/apps/demo/startup.sh
@@ -8,6 +8,6 @@ wait-for-it.sh --host=localhost --port=9999 --strict --timeout=0 -- ./initialdat
 
 java -Djdk.tls.ephemeralDHKeySize=2048 \
      -classpath '/root/resources:/root/classes:/root/libs/*' \
-     -javaagent:/root/libs/openjpa-3.1.2.jar \
+     -javaagent:/root/libs/openjpa-3.2.0.jar \
      -Dlogback.configurationFile=/root/conf/logback.xml \
-      -Dworking.directory=/root/ org.apache.james.JPAJamesServerMain
\ No newline at end of file
+      -Dworking.directory=/root/ org.apache.james.JPAJamesServerMain


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


[james-project] 28/28: JAMES-3914 Fix SieveIntegrationTest

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 1a045fabd817975cd29acaa18669b6d67d76020b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Jun 14 09:28:33 2023 +0700

    JAMES-3914 Fix SieveIntegrationTest
---
 .../james/transport/mailets/delivery/SieveIntegrationTest.java      | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 884dbfe606..456fcfc46a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -51,6 +51,8 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 
+import com.google.common.collect.ImmutableList;
+
 class SieveIntegrationTest {
 
     private static final String LOCAL_PART = "receiver";
@@ -168,7 +170,7 @@ class SieveIntegrationTest {
         mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
         testee.service(mail);
 
-        assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX_ANY);
+        assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX_ANY);
     }
 
     @Test
@@ -913,7 +915,7 @@ class SieveIntegrationTest {
         mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("other@domain.tld")));
         testee.service(mail);
 
-        assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX);
+        assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX);
 
         FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
             .sender(new MailAddress(RECEIVER_DOMAIN_COM))


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


[james-project] 18/28: JAMES-3906 Tests (and fix) for certificate reload

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 341f2570afaea76d90629b1fa71c2dda69ce2bab
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu May 25 17:55:49 2023 +0700

    JAMES-3906 Tests (and fix) for certificate reload
---
 .../AbstractSSLAwareChannelPipelineFactory.java    |  12 +-
 .../apache/james/protocols/netty/NettyServer.java  |   2 +-
 .../apache/james/JamesServerConcreteContract.java  |   2 +-
 .../apache/james/JamesServerConcreteContract.java  |   2 +-
 .../org/apache/james/CertificateReloadTest.java    | 218 +++++++++++++++++++++
 .../org/apache/james/MemoryJamesServerTest.java    |   2 +-
 .../memory-app/src/test/resources/imapserver2.xml  |  73 +++++++
 .../memory-app/src/test/resources/jwt_publickey    |   9 +
 .../apps/memory-app/src/test/resources/keystore2   | Bin 0 -> 2726 bytes
 .../memory-app/src/test/resources/smtpserver2.xml  | 136 +++++++++++++
 .../org/apache/james/TemporaryJamesServer.java     |  18 +-
 .../james/modules/protocols/ImapGuiceProbe.java    |   7 +-
 .../james/modules/protocols/SmtpGuiceProbe.java    |   7 +
 .../lib/netty/AbstractConfigurableAsyncServer.java |   2 +-
 14 files changed, 468 insertions(+), 22 deletions(-)

diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
index 8152aaeeed..dc7e4330a4 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.james.protocols.netty;
 
+import java.util.function.Supplier;
+
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.channel.socket.SocketChannel;
@@ -30,7 +32,7 @@ import io.netty.util.concurrent.EventExecutorGroup;
 @ChannelHandler.Sharable
 public abstract class AbstractSSLAwareChannelPipelineFactory<C extends SocketChannel> extends AbstractChannelPipelineFactory<C> {
     private final boolean proxyRequired;
-    private Encryption secure;
+    private Supplier<Encryption> secure;
 
     public AbstractSSLAwareChannelPipelineFactory(int timeout,
                                                   int maxConnections, int maxConnectsPerIp,
@@ -42,7 +44,7 @@ public abstract class AbstractSSLAwareChannelPipelineFactory<C extends SocketCha
     }
 
     public AbstractSSLAwareChannelPipelineFactory(int timeout,
-            int maxConnections, int maxConnectsPerIp, boolean proxyRequired, Encryption secure,
+            int maxConnections, int maxConnectsPerIp, boolean proxyRequired, Supplier<Encryption> secure,
             ChannelHandlerFactory frameHandlerFactory, EventExecutorGroup eventExecutorGroup) {
         this(timeout, maxConnections, maxConnectsPerIp, proxyRequired, frameHandlerFactory, eventExecutorGroup);
 
@@ -55,9 +57,9 @@ public abstract class AbstractSSLAwareChannelPipelineFactory<C extends SocketCha
 
         if (isSSLSocket()) {
             if (proxyRequired) {
-                channel.pipeline().addAfter("proxyInformationHandler", HandlerConstants.SSL_HANDLER, secure.sslHandler());
+                channel.pipeline().addAfter("proxyInformationHandler", HandlerConstants.SSL_HANDLER, secure.get().sslHandler());
             } else {
-                channel.pipeline().addFirst(HandlerConstants.SSL_HANDLER, secure.sslHandler());
+                channel.pipeline().addFirst(HandlerConstants.SSL_HANDLER, secure.get().sslHandler());
             }
         }
     }
@@ -66,6 +68,6 @@ public abstract class AbstractSSLAwareChannelPipelineFactory<C extends SocketCha
      * Return if the socket is using SSL/TLS
      */
     protected boolean isSSLSocket() {
-        return secure != null && secure.supportsEncryption() && !secure.isStartTLS();
+        return secure != null && secure.get().supportsEncryption() && !secure.get().isStartTLS();
     }
 }
diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
index d6c16e4537..e36f086801 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
@@ -126,7 +126,7 @@ public class NettyServer extends AbstractAsyncServer {
             maxCurConnections,
             maxCurConnectionsPerIP,
             proxyRequired,
-            secure,
+            () -> secure,
             getFrameHandlerFactory(),
             new DefaultEventLoopGroup(16)) {
 
diff --git a/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java b/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
index ee6b338e87..3ac19242ee 100644
--- a/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
+++ b/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
@@ -32,7 +32,7 @@ public interface JamesServerConcreteContract extends JamesServerContract {
 
     @Override
     default int imapsPort(GuiceJamesServer server) {
-        return server.getProbe(ImapGuiceProbe.class).getImapsPort();
+        return server.getProbe(ImapGuiceProbe.class).getImapStartTLSPort();
     }
 
     @Override
diff --git a/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java b/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
index ee6b338e87..3ac19242ee 100644
--- a/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
+++ b/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java
@@ -32,7 +32,7 @@ public interface JamesServerConcreteContract extends JamesServerContract {
 
     @Override
     default int imapsPort(GuiceJamesServer server) {
-        return server.getProbe(ImapGuiceProbe.class).getImapsPort();
+        return server.getProbe(ImapGuiceProbe.class).getImapStartTLSPort();
     }
 
     @Override
diff --git a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
new file mode 100644
index 0000000000..8de9a48892
--- /dev/null
+++ b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java
@@ -0,0 +1,218 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.james.MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE;
+import static org.apache.james.jmap.JMAPTestingConstants.LOCALHOST_IP;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.james.data.UsersRepositoryModuleChooser;
+import org.apache.james.modules.data.MemoryUsersRepositoryModule;
+import org.apache.james.modules.protocols.ImapGuiceProbe;
+import org.apache.james.modules.protocols.SmtpGuiceProbe;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.webadmin.WebAdminConfiguration;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import com.google.common.collect.ImmutableList;
+
+import io.restassured.RestAssured;
+
+class CertificateReloadTest {
+
+    public static class BlindTrustManager implements X509TrustManager {
+        public X509Certificate[] getAcceptedIssuers() {
+            return null;
+        }
+
+        public void checkClientTrusted(X509Certificate[] chain, String authType) {
+
+        }
+
+        public void checkServerTrusted(X509Certificate[] chain, String authType) {
+
+
+        }
+    }
+
+    private static final List<String> BASE_CONFIGURATION_FILE_NAMES = ImmutableList.of("dnsservice.xml",
+        "dnsservice.xml",
+        "imapserver.xml",
+        "imapserver2.xml",
+        "jwt_publickey",
+        "lmtpserver.xml",
+        "keystore",
+        "mailetcontainer.xml",
+        "mailrepositorystore.xml",
+        "managesieveserver.xml",
+        "pop3server.xml",
+        "smtpserver.xml",
+        "smtpserver2.xml");
+
+    private GuiceJamesServer jamesServer;
+    private TemporaryJamesServer temporaryJamesServer;
+
+    @BeforeEach
+    void beforeEach(@TempDir Path workingPath) {
+        temporaryJamesServer = new TemporaryJamesServer(workingPath.toFile(), BASE_CONFIGURATION_FILE_NAMES);
+
+        jamesServer = temporaryJamesServer.getJamesServer()
+            .combineWith(IN_MEMORY_SERVER_AGGREGATE_MODULE)
+            .combineWith(new UsersRepositoryModuleChooser(new MemoryUsersRepositoryModule())
+                .chooseModules(UsersRepositoryModuleChooser.Implementation.DEFAULT))
+            .overrideWith(binder -> binder.bind(WebAdminConfiguration.class).toInstance(WebAdminConfiguration.TEST_CONFIGURATION));
+
+    }
+
+    @AfterEach
+    void afterEach() {
+        if (jamesServer != null && jamesServer.isStarted()) {
+            jamesServer.stop();
+        }
+    }
+
+    @Test
+    void subjectShouldBeKeptWhenNoRestart() throws Exception {
+        temporaryJamesServer.copyResources("smtpserver2.xml", "smtpserver.xml");
+        jamesServer.start();
+
+        assertThat(getServerCertificate(jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpSslPort().getValue()).getSubjectX500Principal().getName())
+            .isEqualTo("CN=Benoit Tellier,OU=Linagora,O=James,L=Puteaux,ST=Unknown,C=FR");
+    }
+
+    private X509Certificate getServerCertificate(int port) throws NoSuchAlgorithmException, KeyManagementException, IOException {
+        SSLSocket clientConnection = openSSLConnection(port);
+
+        return Arrays.stream(clientConnection.getSession()
+            .getPeerCertificates())
+            .filter(X509Certificate.class::isInstance)
+            .map(X509Certificate.class::cast)
+            .findFirst()
+            .orElseThrow();
+    }
+
+    private SSLSocket openSSLConnection(int port) throws NoSuchAlgorithmException, KeyManagementException, IOException {
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        ctx.init(null, new TrustManager[]{new BlindTrustManager()}, null);
+        SSLSocket clientConnection = (SSLSocket) ctx.getSocketFactory().createSocket(LOCALHOST_IP, port);
+        return clientConnection;
+    }
+
+    @Test
+    void reloadShouldUpdateCertificates() throws Exception {
+        temporaryJamesServer.copyResources("smtpserver2.xml", "smtpserver.xml");
+        jamesServer.start();
+
+        temporaryJamesServer.copyResources("keystore2", "keystore");
+
+        WebAdminGuiceProbe webAdminGuiceProbe = jamesServer.getProbe(WebAdminGuiceProbe.class);
+        RestAssured.requestSpecification = WebAdminUtils.buildRequestSpecification(webAdminGuiceProbe.getWebAdminPort())
+            .build();
+
+        int port = jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpSslPort().getValue();
+        given()
+            .queryParam("reload-certificate")
+            .queryParam("port", port)
+        .when()
+            .post("/servers")
+        .then()
+            .statusCode(204);
+
+        assertThat(getServerCertificate(port).getSubjectX500Principal().getName())
+            .isEqualTo("CN=Testing,OU=Testing,O=Testing,L=Testing,ST=Testing,C=Te");
+    }
+
+    @Test
+    void reloadShouldUpdateCertificatesForImap() throws Exception {
+        temporaryJamesServer.copyResources("imapserver2.xml", "imapserver.xml");
+        jamesServer.start();
+
+        temporaryJamesServer.copyResources("keystore2", "keystore");
+
+        WebAdminGuiceProbe webAdminGuiceProbe = jamesServer.getProbe(WebAdminGuiceProbe.class);
+        RestAssured.requestSpecification = WebAdminUtils.buildRequestSpecification(webAdminGuiceProbe.getWebAdminPort())
+            .build();
+
+        int port = jamesServer.getProbe(ImapGuiceProbe.class).getImapSSLPort();
+        given()
+            .queryParam("reload-certificate")
+            .queryParam("port", port)
+        .when()
+            .post("/servers")
+        .then()
+            .statusCode(204);
+
+        assertThat(getServerCertificate(port).getSubjectX500Principal().getName())
+            .isEqualTo("CN=Testing,OU=Testing,O=Testing,L=Testing,ST=Testing,C=Te");
+    }
+
+    @Test
+    void reloadShouldNotAbortExistingConnections() throws Exception {
+        temporaryJamesServer.copyResources("smtpserver2.xml", "smtpserver.xml");
+        jamesServer.start();
+        int port = jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpSslPort().getValue();
+        SSLSocket channel = openSSLConnection(port);
+
+        temporaryJamesServer.copyResources("keystore2", "keystore");
+
+        WebAdminGuiceProbe webAdminGuiceProbe = jamesServer.getProbe(WebAdminGuiceProbe.class);
+        RestAssured.requestSpecification = WebAdminUtils.buildRequestSpecification(webAdminGuiceProbe.getWebAdminPort())
+            .build();
+
+        given()
+            .queryParam("reload-certificate")
+            .queryParam("port", jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpSslPort().getValue())
+        .when()
+            .post("/servers")
+        .then()
+            .statusCode(204);
+
+        System.out.println(readBytes(channel));
+        channel.getOutputStream().write("EHLO toto.com\r\n".getBytes(StandardCharsets.UTF_8));
+        assertThat(readBytes(channel))
+            .contains("250 8BITMIME");
+    }
+
+    private String readBytes(SSLSocket sslSocket) throws IOException {
+        byte[] bline = new byte[1024];
+        final int read = sslSocket.getInputStream().read(bline);
+        return new String(bline, 0, read);
+    }
+
+}
diff --git a/server/apps/memory-app/src/test/java/org/apache/james/MemoryJamesServerTest.java b/server/apps/memory-app/src/test/java/org/apache/james/MemoryJamesServerTest.java
index 74245c157f..da68ed1af5 100644
--- a/server/apps/memory-app/src/test/java/org/apache/james/MemoryJamesServerTest.java
+++ b/server/apps/memory-app/src/test/java/org/apache/james/MemoryJamesServerTest.java
@@ -36,7 +36,7 @@ class MemoryJamesServerTest implements JamesServerContract {
 
     @Override
     public int imapsPort(GuiceJamesServer server) {
-        return server.getProbe(ImapGuiceProbe.class).getImapsPort();
+        return server.getProbe(ImapGuiceProbe.class).getImapStartTLSPort();
     }
 
     @Override
diff --git a/server/apps/memory-app/src/test/resources/imapserver2.xml b/server/apps/memory-app/src/test/resources/imapserver2.xml
new file mode 100644
index 0000000000..067bd16190
--- /dev/null
+++ b/server/apps/memory-app/src/test/resources/imapserver2.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<imapservers>
+    <imapserver enabled="true">
+        <jmxName>imapserver</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <!-- To create a new keystore execute:
+            keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore
+              -->
+            <keystore>classpath://keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+        </tls>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <plainAuthDisallowed>false</plainAuthDisallowed>
+        <gracefulShutdown>false</gracefulShutdown>
+    </imapserver>
+    <imapserver enabled="true">
+        <jmxName>imapserver-ssl</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="true">
+            <!-- To create a new keystore execute:
+              keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore
+             -->
+            <keystore>classpath://keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+        </tls>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <gracefulShutdown>false</gracefulShutdown>
+    </imapserver>
+    <imapserver enabled="true">
+        <jmxName>imapserver-ssl2</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="true" startTLS="false">
+            <!-- To create a new keystore execute:
+              keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore
+             -->
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+        </tls>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <gracefulShutdown>false</gracefulShutdown>
+    </imapserver>
+</imapservers>
diff --git a/server/apps/memory-app/src/test/resources/jwt_publickey b/server/apps/memory-app/src/test/resources/jwt_publickey
new file mode 100644
index 0000000000..53914e0533
--- /dev/null
+++ b/server/apps/memory-app/src/test/resources/jwt_publickey
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh
+16XrMRf6M4NeyGa7j5+1UKm42IKUf3lM28oe82MqIIRyvskPc11NuzSor8HmvH8H
+lhDs5DyJtx2qp35AT0zCqfwlaDnlDc/QDlZv1CoRZGpQk1Inyh6SbZwYpxxwh0fi
++d/4RpE3LBVo8wgOaXPylOlHxsDizfkL8QwXItyakBfMO6jWQRrj7/9WDhGf4Hi+
+GQur1tPGZDl9mvCoRHjFrD5M/yypIPlfMGWFVEvV5jClNMLAQ9bYFuOc7H1fEWw6
+U1LZUUbJW9/CH45YXz82CYqkrfbnQxqRb2iVbVjs/sHopHd1NTiCfUtwvcYJiBVj
+kwIDAQAB
+-----END PUBLIC KEY-----
diff --git a/server/apps/memory-app/src/test/resources/keystore2 b/server/apps/memory-app/src/test/resources/keystore2
new file mode 100644
index 0000000000..0b343bbc21
Binary files /dev/null and b/server/apps/memory-app/src/test/resources/keystore2 differ
diff --git a/server/apps/memory-app/src/test/resources/smtpserver2.xml b/server/apps/memory-app/src/test/resources/smtpserver2.xml
new file mode 100644
index 0000000000..713a16d893
--- /dev/null
+++ b/server/apps/memory-app/src/test/resources/smtpserver2.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+
+<smtpservers>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-global</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <auth>
+            <announce>never</announce>
+            <requireSSL>false</requireSSL>
+        </auth>
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
+        <handlerchain>
+            <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+        <gracefulShutdown>false</gracefulShutdown>
+    </smtpserver>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-TLS</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <auth>
+            <announce>forUnauthorizedAddresses</announce>
+            <requireSSL>false</requireSSL>
+        </auth>
+        <!-- Trust authenticated users -->
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
+        <handlerchain>
+            <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+        <gracefulShutdown>false</gracefulShutdown>
+    </smtpserver>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-authenticated</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <auth>
+            <announce>forUnauthorizedAddresses</announce>
+            <requireSSL>false</requireSSL>
+        </auth>
+        <!-- Trust authenticated users -->
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
+        <handlerchain>
+            <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+        <gracefulShutdown>false</gracefulShutdown>
+    </smtpserver>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-ssl</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="true" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <auth>
+            <announce>forUnauthorizedAddresses</announce>
+            <requireSSL>false</requireSSL>
+        </auth>
+        <!-- Trust authenticated users -->
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
+        <handlerchain>
+            <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+        <gracefulShutdown>false</gracefulShutdown>
+    </smtpserver>
+</smtpservers>
+
+
diff --git a/server/container/guice/common/src/main/java/org/apache/james/TemporaryJamesServer.java b/server/container/guice/common/src/main/java/org/apache/james/TemporaryJamesServer.java
index 231d3586c2..ed4f330123 100644
--- a/server/container/guice/common/src/main/java/org/apache/james/TemporaryJamesServer.java
+++ b/server/container/guice/common/src/main/java/org/apache/james/TemporaryJamesServer.java
@@ -25,12 +25,10 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.james.server.core.configuration.Configuration;
 
 import com.google.common.collect.ImmutableList;
@@ -77,19 +75,17 @@ public class TemporaryJamesServer {
         return jamesServer;
     }
 
-    public void appendConfigurationFile(String configurationData, String configurationFileName) throws IOException {
-        try (OutputStream outputStream = new FileOutputStream(Paths.get(configurationFolder.getAbsolutePath(), configurationFileName).toFile())) {
-            IOUtils.write(configurationData, outputStream, StandardCharsets.UTF_8);
-        }
-    }
-
     private void copyResources(Path resourcesFolder) {
         configurationFileNames
-            .forEach(resourceName -> copyResource(resourcesFolder, resourceName));
+            .forEach(resourceName -> copyResource(resourcesFolder, resourceName, resourceName));
+    }
+
+    public void copyResources(String resourceName, String targetName) {
+        copyResource(Paths.get(configurationFolder.getAbsolutePath()), resourceName, targetName);
     }
 
-    public static void copyResource(Path resourcesFolder, String resourceName) {
-        var resolvedResource = resourcesFolder.resolve(resourceName);
+    public static void copyResource(Path resourcesFolder, String resourceName, String targetName) {
+        var resolvedResource = resourcesFolder.resolve(targetName);
         try (OutputStream outputStream = new FileOutputStream(resolvedResource.toFile())) {
             URL resource = ClassLoader.getSystemClassLoader().getResource(resourceName);
             if (resource != null) {
diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/ImapGuiceProbe.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/ImapGuiceProbe.java
index a9bc25a856..5be2ebcae8 100644
--- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/ImapGuiceProbe.java
+++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/ImapGuiceProbe.java
@@ -49,11 +49,16 @@ public class ImapGuiceProbe implements GuiceProbe {
             .orElseThrow(() -> new IllegalStateException("IMAP server not defined"));
     }
 
-    public int getImapsPort() {
+    public int getImapStartTLSPort() {
         return getPort(AbstractConfigurableAsyncServer::getStartTLSSupported)
             .orElseThrow(() -> new IllegalStateException("IMAPS server not defined"));
     }
 
+    public int getImapSSLPort() {
+        return getPort(server -> server.getSocketType().equals("secure"))
+            .orElseThrow(() -> new IllegalStateException("IMAPS server not defined"));
+    }
+
     private Optional<Integer> getPort(Predicate<? super AbstractConfigurableAsyncServer> filter) {
         return imapServerFactory.getServers().stream()
             .filter(filter)
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
index 4c8ebaf0ed..ed07df2af4 100644
--- a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SmtpGuiceProbe.java
@@ -64,6 +64,13 @@ public class SmtpGuiceProbe implements GuiceProbe {
         return getPort(AbstractConfigurableAsyncServer::getStartTLSSupported);
     }
 
+    public Port getSmtpSslPort() {
+        return getPort(server -> {
+            System.out.println(server.getServiceType());
+            return server.getSocketType().equals("secure");
+        });
+    }
+
     public Port getSmtpAuthRequiredPort() {
         return getPort(server -> ((SMTPServer) server).getAuthRequired().equals(FOR_UNAUTHORIZED_ADDRESSES));
     }
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index b6ded174ed..777026bab2 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -463,7 +463,7 @@ public abstract class AbstractConfigurableAsyncServer
     protected AbstractChannelPipelineFactory createPipelineFactory() {
         return new AbstractSSLAwareChannelPipelineFactory<>(getTimeout(), connectionLimit, connPerIP,
             proxyRequired,
-            getEncryption(), getFrameHandlerFactory(), getExecutorGroup()) {
+            this::getEncryption, getFrameHandlerFactory(), getExecutorGroup()) {
 
             @Override
             protected ChannelInboundHandlerAdapter createHandler() {


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


[james-project] 02/28: [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6855334242d0f60df6e5f2919766dd11982f9617
Author: Trần Hồng Quân <55...@users.noreply.github.com>
AuthorDate: Thu May 18 17:10:21 2023 +0700

    [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564)
    
    Before, we were using Non-Preemptive authentication for OpenSearch that makes 1 normal OpenSearch request to be 2 round trips (1 authenticated 401 request and 1 normal request).
    This likely negatively affected our search performance.
    We should avoid that.
    
    rf: https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/master/_basic_authentication.html
---
 .../main/java/org/apache/james/backends/opensearch/ClientProvider.java   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java b/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java
index 28b09fa383..d253fc6d6b 100644
--- a/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java
+++ b/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java
@@ -169,7 +169,6 @@ public class ClientProvider implements Provider<ReactorOpenSearchClient> {
         }
 
         private void configureAuthentication(HttpAsyncClientBuilder builder) {
-            builder.disableAuthCaching();
             configuration.getCredential()
                 .ifPresent(credential -> {
                     CredentialsProvider credentialsProvider = new BasicCredentialsProvider();


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


[james-project] 09/28: Allow passing openjpa and underlying datasource (DBCP2) properties (#1580)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 534a7848183c7172d155b52ba0431f5adfc996b5
Author: Wojtek <wo...@users.noreply.github.com>
AuthorDate: Mon Jun 12 04:25:44 2023 -0400

    Allow passing openjpa and underlying datasource (DBCP2) properties (#1580)
---
 .../james/modules/data/JPAConfiguration.java       | 87 ++++++++++++++++++++--
 .../james/modules/data/JPAEntityManagerModule.java | 53 +++++++++----
 src/site/xdoc/server/config-system.xml             |  9 ++-
 3 files changed, 126 insertions(+), 23 deletions(-)

diff --git a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java
index bed6c9041a..62419c1bb2 100644
--- a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java
+++ b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java
@@ -19,11 +19,17 @@
 package org.apache.james.modules.data;
 
 import static org.apache.james.modules.data.JPAConfiguration.Credential.NO_CREDENTIAL;
+import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.CUSTOM_DATASOURCE_PROPERTIES;
+import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.CUSTOM_OPENJPA_PROPERTIES;
 import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_MAX_CONNECTIONS;
+import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_MULTITHREADED;
 import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_TEST_ON_BORROW;
 import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_VALIDATION_QUERY;
 import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_VALIDATION_QUERY_TIMEOUT_SEC;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 
 import org.apache.commons.lang3.StringUtils;
@@ -34,6 +40,23 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 
 public class JPAConfiguration {
+    static final String JPA_CONNECTION_DRIVER_NAME = "openjpa.ConnectionDriverName";
+    static final String JPA_CONNECTION_USERNAME = "openjpa.ConnectionUserName";
+    static final String JPA_CONNECTION_PASSWORD = "openjpa.ConnectionPassword";
+    static final String JPA_CONNECTION_PROPERTIES = "openjpa.ConnectionProperties";
+    static final String JPA_CONNECTION_URL = "openjpa.ConnectionURL";
+    static final String JPA_MULTITHREADED = "openjpa.Multithreaded";
+    static List<String> DEFAULT_JPA_PROPERTIES = List.of(JPA_CONNECTION_DRIVER_NAME, JPA_CONNECTION_URL, JPA_MULTITHREADED, JPA_CONNECTION_USERNAME, JPA_CONNECTION_PASSWORD);
+
+    static final String DATASOURCE_TEST_ON_BORROW = "datasource.testOnBorrow";
+    static final String DATASOURCE_VALIDATION_QUERY_TIMEOUT_SEC = "datasource.validationQueryTimeoutSec";
+    static final String DATASOURCE_VALIDATION_QUERY = "datasource.validationQuery";
+    static final String DATASOURCE_MAX_TOTAL = "datasource.maxTotal";
+    static List<String> DEFAULT_DATASOURCE_PROPERTIES = List.of(DATASOURCE_TEST_ON_BORROW, DATASOURCE_VALIDATION_QUERY_TIMEOUT_SEC, DATASOURCE_VALIDATION_QUERY, DATASOURCE_MAX_TOTAL);
+
+    static {
+    }
+
     public static class Credential {
         private static final Logger LOGGER = LoggerFactory.getLogger(Credential.class);
         static final Optional<Credential> NO_CREDENTIAL = Optional.empty();
@@ -78,40 +101,50 @@ public class JPAConfiguration {
 
     public static class ReadyToBuild {
         static final Optional<Boolean> NO_TEST_ON_BORROW = Optional.empty();
+        static final Optional<Boolean> NO_MULTITHREADED = Optional.empty();
         static final Optional<Integer> NO_VALIDATION_QUERY_TIMEOUT_SEC = Optional.empty();
         static final Optional<String> NO_VALIDATION_QUERY = Optional.empty();
         static final Optional<Integer> NO_MAX_CONNECTIONS = Optional.empty();
+        static final Map<String,String> CUSTOM_OPENJPA_PROPERTIES = Map.of();
+        static final Map<String,String> CUSTOM_DATASOURCE_PROPERTIES = Map.of();
 
         private final String driverName;
         private final String driverURL;
 
         private Optional<Credential> credential;
         private Optional<Boolean> testOnBorrow;
+        private Optional<Boolean> multithreaded;
         private Optional<Integer> validationQueryTimeoutSec;
         private Optional<String> validationQuery;
         private Optional<Integer> maxConnections;
+        private Map<String,String> customDatasourceProperties;
+        private Map<String,String> customOpenjpaProperties;
 
 
         private ReadyToBuild(String driverName, String driverURL, Optional<Credential> credential,
-                            Optional<Boolean> testOnBorrow, Optional<Integer> validationQueryTimeoutSec,
-                            Optional<String> validationQuery,Optional<Integer> maxConnections
+                            Optional<Boolean> testOnBorrow, Optional<Boolean> multithreaded, Optional<Integer> validationQueryTimeoutSec,
+                            Optional<String> validationQuery,Optional<Integer> maxConnections,
+                            Map<String,String> customDatasourceProperties, Map<String,String> customOpenjpaProperties
         ) {
             this.driverName = driverName;
             this.driverURL = driverURL;
             this.credential = credential;
             this.testOnBorrow = testOnBorrow;
+            this.multithreaded = multithreaded;
             this.validationQueryTimeoutSec = validationQueryTimeoutSec;
             this.validationQuery = validationQuery;
             this.maxConnections = maxConnections;
+            this.customDatasourceProperties = customDatasourceProperties;
+            this.customOpenjpaProperties = customOpenjpaProperties;
         }
 
         public JPAConfiguration build() {
-            return new JPAConfiguration(driverName, driverURL, credential, testOnBorrow, validationQueryTimeoutSec, validationQuery, maxConnections);
+            return new JPAConfiguration(driverName, driverURL, credential, testOnBorrow, multithreaded, validationQueryTimeoutSec, validationQuery, maxConnections, customDatasourceProperties, customOpenjpaProperties);
         }
 
         public RequirePassword username(String username) {
             return password -> new ReadyToBuild(driverName, driverURL, Credential.of(username, password),
-                testOnBorrow, validationQueryTimeoutSec, validationQuery, maxConnections);
+                testOnBorrow, multithreaded, validationQueryTimeoutSec, validationQuery, maxConnections, customDatasourceProperties, customOpenjpaProperties);
         }
 
         public ReadyToBuild testOnBorrow(Boolean testOnBorrow) {
@@ -119,6 +152,11 @@ public class JPAConfiguration {
             return this;
         }
 
+        public ReadyToBuild multithreaded(Boolean multithreaded) {
+            this.multithreaded = Optional.ofNullable(multithreaded);
+            return this;
+        }
+
         public ReadyToBuild validationQueryTimeoutSec(Integer validationQueryTimeoutSec) {
             this.validationQueryTimeoutSec = Optional.ofNullable(validationQueryTimeoutSec);
             return this;
@@ -133,6 +171,19 @@ public class JPAConfiguration {
             this.maxConnections = Optional.ofNullable(maxConnections);
             return this;
         }
+
+        public ReadyToBuild setCustomDatasourceProperties(Map<String, String> customDatasourceProperties) {
+            this.customDatasourceProperties = new HashMap<>(customDatasourceProperties);
+            DEFAULT_DATASOURCE_PROPERTIES.forEach(this.customDatasourceProperties::remove);
+            return this;
+        }
+
+        public ReadyToBuild setCustomOpenjpaProperties(Map<String, String> customOpenjpaProperties) {
+            this.customOpenjpaProperties = customOpenjpaProperties;
+            DEFAULT_JPA_PROPERTIES.forEach(this.customOpenjpaProperties::remove);
+            return this;
+        }
+
     }
 
     @FunctionalInterface
@@ -141,21 +192,25 @@ public class JPAConfiguration {
     }
 
     public static RequireDriverName builder() {
-        return driverName -> driverURL -> new ReadyToBuild(driverName, driverURL, NO_CREDENTIAL, NO_TEST_ON_BORROW,
-            NO_VALIDATION_QUERY_TIMEOUT_SEC, NO_VALIDATION_QUERY, NO_MAX_CONNECTIONS);
+        return driverName -> driverURL -> new ReadyToBuild(driverName, driverURL, NO_CREDENTIAL, NO_TEST_ON_BORROW, NO_MULTITHREADED,
+            NO_VALIDATION_QUERY_TIMEOUT_SEC, NO_VALIDATION_QUERY, NO_MAX_CONNECTIONS, CUSTOM_DATASOURCE_PROPERTIES, CUSTOM_OPENJPA_PROPERTIES);
     }
 
     private final String driverName;
     private final String driverURL;
     private final Optional<Boolean> testOnBorrow;
+    private final Optional<Boolean> multithreaded;
     private final Optional<Integer> validationQueryTimeoutSec;
     private final Optional<Credential> credential;
     private final Optional<String> validationQuery;
     private final Optional<Integer> maxConnections;
+    private Map<String,String> customDatasourceProperties;
+    private Map<String,String> customOpenjpaProperties;
+
 
     @VisibleForTesting
-    JPAConfiguration(String driverName, String driverURL, Optional<Credential> credential, Optional<Boolean> testOnBorrow,
-                     Optional<Integer> validationQueryTimeoutSec, Optional<String> validationQuery, Optional<Integer> maxConnections) {
+    JPAConfiguration(String driverName, String driverURL, Optional<Credential> credential, Optional<Boolean> testOnBorrow, Optional<Boolean> multithreaded,
+                     Optional<Integer> validationQueryTimeoutSec, Optional<String> validationQuery, Optional<Integer> maxConnections, Map<String,String> customDatasourceProperties, Map<String,String> customOpenjpaProperties) {
         Preconditions.checkNotNull(driverName, "driverName cannot be null");
         Preconditions.checkNotNull(driverURL, "driverURL cannot be null");
         validationQueryTimeoutSec.ifPresent(timeoutInSec ->
@@ -167,9 +222,13 @@ public class JPAConfiguration {
         this.driverURL = driverURL;
         this.credential = credential;
         this.testOnBorrow = testOnBorrow;
+        this.multithreaded = multithreaded;
         this.validationQueryTimeoutSec = validationQueryTimeoutSec;
         this.validationQuery = validationQuery;
         this.maxConnections = maxConnections;
+        this.customDatasourceProperties = customDatasourceProperties;
+        this.customOpenjpaProperties = customOpenjpaProperties;
+
     }
 
     public String getDriverName() {
@@ -184,6 +243,10 @@ public class JPAConfiguration {
         return testOnBorrow;
     }
 
+    public Optional<Boolean> isMultithreaded() {
+        return multithreaded;
+    }
+
     public Optional<Integer> getValidationQueryTimeoutSec() {
         return validationQueryTimeoutSec;
     }
@@ -196,6 +259,14 @@ public class JPAConfiguration {
         return credential;
     }
 
+    public Map<String, String> getCustomOpenjpaProperties() {
+        return customOpenjpaProperties;
+    }
+
+    public Map<String, String> getCustomDatasourceProperties() {
+        return customDatasourceProperties;
+    }
+
 
     public Optional<Integer> getMaxConnections() {
         return maxConnections;
diff --git a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAEntityManagerModule.java b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAEntityManagerModule.java
index 8024f4f8b7..efcc300c11 100644
--- a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAEntityManagerModule.java
+++ b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAEntityManagerModule.java
@@ -21,7 +21,10 @@ package org.apache.james.modules.data;
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 import javax.inject.Singleton;
 import javax.persistence.EntityManagerFactory;
@@ -41,25 +44,30 @@ public class JPAEntityManagerModule extends AbstractModule {
     public EntityManagerFactory provideEntityManagerFactory(JPAConfiguration jpaConfiguration) {
         HashMap<String, String> properties = new HashMap<>();
 
-        properties.put("openjpa.ConnectionDriverName", jpaConfiguration.getDriverName());
-        properties.put("openjpa.ConnectionURL", jpaConfiguration.getDriverURL());
+        properties.put(JPAConfiguration.JPA_CONNECTION_DRIVER_NAME, jpaConfiguration.getDriverName());
+        properties.put(JPAConfiguration.JPA_CONNECTION_URL, jpaConfiguration.getDriverURL());
         jpaConfiguration.getCredential()
             .ifPresent(credential -> {
-                properties.put("openjpa.ConnectionUserName", credential.getUsername());
-                properties.put("openjpa.ConnectionPassword", credential.getPassword());
+                properties.put(JPAConfiguration.JPA_CONNECTION_USERNAME, credential.getUsername());
+                properties.put(JPAConfiguration.JPA_CONNECTION_PASSWORD, credential.getPassword());
             });
 
-        List<String> connectionFactoryProperties = new ArrayList<>();
-        connectionFactoryProperties.add("TestOnBorrow=" + jpaConfiguration.isTestOnBorrow());
+        List<String> connectionProperties = new ArrayList<>();
+        jpaConfiguration.isTestOnBorrow().ifPresent(testOnBorrow -> connectionProperties.add("TestOnBorrow=" + testOnBorrow));
         jpaConfiguration.getValidationQueryTimeoutSec()
-            .ifPresent(timeoutSecond -> connectionFactoryProperties.add("ValidationTimeout=" + timeoutSecond * 1000));
+            .ifPresent(timeoutSecond -> connectionProperties.add("ValidationTimeout=" + timeoutSecond * 1000));
         jpaConfiguration.getValidationQuery()
-            .ifPresent(validationQuery -> connectionFactoryProperties.add("ValidationSQL='" + validationQuery + "'"));
-        jpaConfiguration.getMaxConnections().ifPresent(maxConnections ->
-                connectionFactoryProperties.add("MaxTotal=" + maxConnections)
-        );
+            .ifPresent(validationQuery -> connectionProperties.add("ValidationSQL='" + validationQuery + "'"));
+        jpaConfiguration.getMaxConnections()
+                .ifPresent(maxConnections -> connectionProperties.add("MaxTotal=" + maxConnections));
 
-        properties.put("openjpa.ConnectionFactoryProperties", Joiner.on(", ").join(connectionFactoryProperties));
+        connectionProperties.addAll(jpaConfiguration.getCustomDatasourceProperties().entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).collect(Collectors.toList()));
+        properties.put(JPAConfiguration.JPA_CONNECTION_PROPERTIES, Joiner.on(",").join(connectionProperties));
+        properties.putAll(jpaConfiguration.getCustomOpenjpaProperties());
+
+        if (jpaConfiguration.isMultithreaded().isPresent()) {
+            properties.put(JPAConfiguration.JPA_MULTITHREADED, jpaConfiguration.isMultithreaded().get().toString());
+        }
 
         return Persistence.createEntityManagerFactory("Global", properties);
     }
@@ -68,15 +76,34 @@ public class JPAEntityManagerModule extends AbstractModule {
     @Singleton
     JPAConfiguration provideConfiguration(PropertiesProvider propertiesProvider) throws FileNotFoundException, ConfigurationException {
         Configuration dataSource = propertiesProvider.getConfiguration("james-database");
+
+        Map<String, String> openjpaProperties = getKeysForPrefix(dataSource, "openjpa", false);
+        Map<String, String> datasourceProperties = getKeysForPrefix(dataSource, "datasource", true);
+
+
         return JPAConfiguration.builder()
                 .driverName(dataSource.getString("database.driverClassName"))
                 .driverURL(dataSource.getString("database.url"))
                 .testOnBorrow(dataSource.getBoolean("datasource.testOnBorrow", false))
                 .validationQueryTimeoutSec(dataSource.getInteger("datasource.validationQueryTimeoutSec", null))
                 .validationQuery(dataSource.getString("datasource.validationQuery", null))
-                .maxConnections(dataSource.getInteger("datasource.maxTotal",null))
+                .maxConnections(dataSource.getInteger("datasource.maxTotal", null))
+                .multithreaded(dataSource.getBoolean(JPAConfiguration.JPA_MULTITHREADED, true))
                 .username(dataSource.getString("database.username"))
                 .password(dataSource.getString("database.password"))
+                .setCustomOpenjpaProperties(openjpaProperties)
+                .setCustomDatasourceProperties(datasourceProperties)
                 .build();
     }
+
+    private static Map<String, String> getKeysForPrefix(Configuration dataSource, String prefix, boolean stripPrefix) {
+        Iterator<String> keys = dataSource.getKeys(prefix);
+        Map<String, String> properties = new HashMap<>();
+        while (keys.hasNext()) {
+            String key = keys.next();
+            String propertyKey = stripPrefix ? key.replace(prefix + ".", "") : key;
+            properties.put(propertyKey, dataSource.getString(key));
+        }
+        return properties;
+    }
 }
diff --git a/src/site/xdoc/server/config-system.xml b/src/site/xdoc/server/config-system.xml
index 9d6602a1b8..55650a198a 100644
--- a/src/site/xdoc/server/config-system.xml
+++ b/src/site/xdoc/server/config-system.xml
@@ -88,14 +88,19 @@
                     <dd>true or false - Use streaming for Blobs. This is only supported on a limited set of databases atm. You
                         should check if its supported by your DB before enable it. See <a href="http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html">http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html</a> (#7.11. LOB Streaming).</dd>
                 </dl>
-                <p>The JPA datasource handling is delegated to commons-dbcp, some of dbcp properties can be configured through james-database.properties. The corresponding definitions and default values can be found in the <a href="https://commons.apache.org/proper/commons-dbcp/configuration.html">dbcp documentation</a></p>
+
+                <p>NOTE: all<code>openjpa.*</code> properties will be passed to OpenJPA library as configuration See <a href="https://openjpa.apache.org/builds/3.2.2/apache-openjpa/docs/ref_guide_conf_openjpa.html">https://openjpa.apache.org/builds/3.2.2/apache-openjpa/docs/ref_guide_conf_openjpa.html</a> for a complete list </p>
+
+                <p>The JPA datasource and connection pooling can be delegated to commons-dbcp2 - the library dependency has to be present in classpath for it to be enabled. dbcp2 properties can be configured through james-database.properties - all properties prefixed with <code>datasource.*</code> will be passed to DBCP2 library via <code>openjpa.ConnectionProperties</code> OpenJPA property. The corresponding definitions and default values can be found in the <a href="https://commons.apa [...]
                 <ul>
                     <li>datasource.testOnBorrow</li>
                     <li>datasource.validationQueryTimeoutSec</li>
                     <li>datasource.validationQuery</li>
+                    <li>datasource.initialSize</li>
+                    <li>datasource.minIdle</li>
                     <li>datasource.maxTotal</li>
-
                 </ul>
+                <p>NOTE: Connection poolling requires that <code>openjpa.Multithreaded</code> property is set to <code>true</code> (default)</p>
                 <p>Note for postgresql databases: Add <code>standard_conforming_strings=off</code> to your postgresql.xml, otherwise you
                     will get <code>""Invalid escape string Hint: Escape string must be empty or one character. {prepstmnt 174928937
                     SELECT t0.mailbox_id, t0.mailbox_highest_modseq, t0.mailbox_last_uid, t0.mailbox_name, t0.mailbox_namespace,


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


[james-project] 24/28: JAMES-3913 Sieve Reject should discard email

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 8f8af3a1e93ff9d2f86d77079c71a400912b10ca
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 12 16:23:42 2023 +0700

    JAMES-3913 Sieve Reject should discard email
---
 .../james/transport/mailets/jsieve/RejectAction.java  |  2 +-
 .../mailets/delivery/SieveIntegrationTest.java        | 16 ++++++++++++++++
 .../james/transport/mailets/delivery/reject.script    | 19 +++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
index b9a81a57f2..9d0bdb7e59 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
@@ -62,8 +62,8 @@ public class RejectAction implements MailAction {
         if (action instanceof ActionReject) {
             final ActionReject actionReject = (ActionReject) action;
             execute(actionReject, mail, context);
+            DiscardAction.removeRecipient(mail, context);
         }
-
     }
 
     /**
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 8ea6611774..47ede08af8 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -463,6 +463,22 @@ class SieveIntegrationTest {
             .containsExactly(expectedSentMail);
     }
 
+    @Test
+    void rejectShouldWork() throws Exception {
+        prepareTestUsingScript("org/apache/james/transport/mailets/delivery/reject.script");
+
+        FakeMail mail = createMail();
+        testee.service(mail);
+
+        FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
+            .recipient("sender@any.com")
+            .fromMailet()
+            .build();
+        assertThat(fakeMailContext.getSentMails())
+            .containsExactly(expectedSentMail);
+        assertThat(mail.getRecipients()).isEmpty();
+    }
+
     @Test
     void redirectShouldWorkWhenSeveralRecipients() throws Exception {
         prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script");
diff --git a/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script b/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script
new file mode 100644
index 0000000000..11e53e3eb1
--- /dev/null
+++ b/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script
@@ -0,0 +1,19 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+reject "Spam not consumed here!";
\ No newline at end of file


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


[james-project] 27/28: [RELEASE] Bump to 3.8.1-SNAPSHOT in examples

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 804f369dd6a270c4e78f13cf00399bf0030d3d25
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Jun 14 09:28:13 2023 +0700

    [RELEASE] Bump to 3.8.1-SNAPSHOT in examples
---
 examples/custom-healthcheck/pom.xml    | 4 ++--
 examples/custom-imap/pom.xml           | 4 ++--
 examples/custom-james-assembly/pom.xml | 4 ++--
 examples/custom-listeners/pom.xml      | 2 +-
 examples/custom-mailets/pom.xml        | 2 +-
 examples/custom-smtp-command/pom.xml   | 4 ++--
 examples/custom-smtp-hooks/pom.xml     | 4 ++--
 examples/custom-webadmin-route/pom.xml | 4 ++--
 examples/metrics-graphite/pom.xml      | 4 ++--
 examples/pom.xml                       | 2 +-
 10 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/examples/custom-healthcheck/pom.xml b/examples/custom-healthcheck/pom.xml
index 5d2e4254d3..659dc0efcc 100644
--- a/examples/custom-healthcheck/pom.xml
+++ b/examples/custom-healthcheck/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>examples</artifactId>
         <groupId>org.apache.james.examples</groupId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -57,4 +57,4 @@
         </plugins>
     </build>
 
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/custom-imap/pom.xml b/examples/custom-imap/pom.xml
index bde530a3a6..613d674284 100644
--- a/examples/custom-imap/pom.xml
+++ b/examples/custom-imap/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>custom-imap</artifactId>
@@ -110,4 +110,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/custom-james-assembly/pom.xml b/examples/custom-james-assembly/pom.xml
index ec6a4f0588..f6dc8ad703 100644
--- a/examples/custom-james-assembly/pom.xml
+++ b/examples/custom-james-assembly/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>custom-james-assembly</artifactId>
@@ -95,4 +95,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/custom-listeners/pom.xml b/examples/custom-listeners/pom.xml
index bdc842460a..80281efde6 100644
--- a/examples/custom-listeners/pom.xml
+++ b/examples/custom-listeners/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.james.examples</groupId>
     <artifactId>examples</artifactId>
-    <version>3.8.0</version>
+    <version>3.8.1-SNAPSHOT</version>
   </parent>
   <artifactId>custom-listeners</artifactId>
   <name>Apache James :: Examples :: Custom Listeners</name>
diff --git a/examples/custom-mailets/pom.xml b/examples/custom-mailets/pom.xml
index 58419fe268..075f91fce4 100644
--- a/examples/custom-mailets/pom.xml
+++ b/examples/custom-mailets/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.james.examples</groupId>
     <artifactId>examples</artifactId>
-    <version>3.8.0</version>
+    <version>3.8.1-SNAPSHOT</version>
   </parent>
   <artifactId>custom-mailets</artifactId>
   <name>Apache James :: Examples :: Custom Mailets</name>
diff --git a/examples/custom-smtp-command/pom.xml b/examples/custom-smtp-command/pom.xml
index 3ad0630c3f..5e86d31bab 100644
--- a/examples/custom-smtp-command/pom.xml
+++ b/examples/custom-smtp-command/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>custom-smtp-command</artifactId>
@@ -51,4 +51,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/custom-smtp-hooks/pom.xml b/examples/custom-smtp-hooks/pom.xml
index 267f6dbb6c..a01a5b1cd2 100644
--- a/examples/custom-smtp-hooks/pom.xml
+++ b/examples/custom-smtp-hooks/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>custom-smtp-hooks</artifactId>
@@ -51,4 +51,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/custom-webadmin-route/pom.xml b/examples/custom-webadmin-route/pom.xml
index 243be775dc..0119c3c113 100644
--- a/examples/custom-webadmin-route/pom.xml
+++ b/examples/custom-webadmin-route/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>custom-webadmin-route</artifactId>
@@ -51,4 +51,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/metrics-graphite/pom.xml b/examples/metrics-graphite/pom.xml
index 0662c2987e..d02ed4edd8 100644
--- a/examples/metrics-graphite/pom.xml
+++ b/examples/metrics-graphite/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.james.examples</groupId>
         <artifactId>examples</artifactId>
-        <version>3.8.0</version>
+        <version>3.8.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>metrics-graphite</artifactId>
@@ -88,4 +88,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/examples/pom.xml b/examples/pom.xml
index 3ca894602e..d8fdd8690a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@
 
   <groupId>org.apache.james.examples</groupId>
   <artifactId>examples</artifactId>
-  <version>3.8.0</version>
+  <version>3.8.1-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>Apache James :: Examples</name>
 


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