james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [14/20] james-project git commit: JAMES-2151 InMemorySieveQuotaRepository should be synchronized
Date Tue, 26 Jun 2018 09:13:10 GMT
JAMES-2151 InMemorySieveQuotaRepository should be synchronized


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/280c6f72
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/280c6f72
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/280c6f72

Branch: refs/heads/master
Commit: 280c6f725f80824312636553f3bb8367c873023b
Parents: 37ba4e3
Author: benwa <btellier@linagora.com>
Authored: Tue Jun 26 09:48:03 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Jun 26 16:09:37 2018 +0700

----------------------------------------------------------------------
 .../memory/InMemorySieveQuotaRepository.java          | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/280c6f72/server/data/data-memory/src/main/java/org/apache/james/sieverepository/memory/InMemorySieveQuotaRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-memory/src/main/java/org/apache/james/sieverepository/memory/InMemorySieveQuotaRepository.java
b/server/data/data-memory/src/main/java/org/apache/james/sieverepository/memory/InMemorySieveQuotaRepository.java
index 3ca888f..0ed13b0 100644
--- a/server/data/data-memory/src/main/java/org/apache/james/sieverepository/memory/InMemorySieveQuotaRepository.java
+++ b/server/data/data-memory/src/main/java/org/apache/james/sieverepository/memory/InMemorySieveQuotaRepository.java
@@ -35,22 +35,22 @@ public class InMemorySieveQuotaRepository implements SieveQuotaRepository
{
     private Map<User, QuotaSize> userQuota = new ConcurrentHashMap<>();
 
     @Override
-    public boolean hasDefaultQuota() {
+    public synchronized boolean hasDefaultQuota() {
         return globalQuota.isPresent();
     }
 
     @Override
-    public QuotaSize getDefaultQuota() throws QuotaNotFoundException {
+    public synchronized QuotaSize getDefaultQuota() throws QuotaNotFoundException {
         return globalQuota.orElseThrow(QuotaNotFoundException::new);
     }
 
     @Override
-    public void setDefaultQuota(QuotaSize quota) {
+    public synchronized void setDefaultQuota(QuotaSize quota) {
         this.globalQuota = Optional.of(quota);
     }
 
     @Override
-    public void removeQuota() throws QuotaNotFoundException {
+    public synchronized void removeQuota() throws QuotaNotFoundException {
         if (!globalQuota.isPresent()) {
             throw new QuotaNotFoundException();
         }
@@ -58,7 +58,7 @@ public class InMemorySieveQuotaRepository implements SieveQuotaRepository
{
     }
 
     @Override
-    public boolean hasQuota(User user) {
+    public synchronized boolean hasQuota(User user) {
         return userQuota.containsKey(user);
     }
 
@@ -69,12 +69,12 @@ public class InMemorySieveQuotaRepository implements SieveQuotaRepository
{
     }
 
     @Override
-    public void setQuota(User user, QuotaSize quota) {
+    public synchronized void setQuota(User user, QuotaSize quota) {
         userQuota.put(user, quota);
     }
 
     @Override
-    public void removeQuota(User user) throws QuotaNotFoundException {
+    public synchronized void removeQuota(User user) throws QuotaNotFoundException {
         Optional<QuotaSize> quotaValue = Optional.ofNullable(userQuota.get(user));
         if (!quotaValue.isPresent()) {
             throw new QuotaNotFoundException();


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


Mime
View raw message