Author: btellier
Date: Wed Jul  1 09:47:31 2015
New Revision: 1688612

URL: http://svn.apache.org/r1688612
Log:
MAILBOX-215 Provide a fake Path locker and use it in Cassandra implementation

Added:
    
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/NoMailboxPathLocker.java
Modified:
    
james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
    
james/mailbox/trunk/spring/src/main/resources/META-INF/spring/mailbox-locker.xml

Modified: 
james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml?rev=1688612&r1=1688611&r2=1688612&view=diff
==============================================================================
--- 
james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
 (original)
+++ 
james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
 Wed Jul  1 09:47:31 2015
@@ -52,7 +52,7 @@
         <constructor-arg index="0" ref="cassandra-session"/>
     </bean>
 
-    <alias name="jvm-locker" alias="cassandra-locker"/>
+    <alias name="no-locker" alias="cassandra-locker"/>
 
     <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="ignoreUnresolvablePlaceholders" value="true"/>

Modified: 
james/mailbox/trunk/spring/src/main/resources/META-INF/spring/mailbox-locker.xml
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/spring/src/main/resources/META-INF/spring/mailbox-locker.xml?rev=1688612&r1=1688611&r2=1688612&view=diff
==============================================================================
--- 
james/mailbox/trunk/spring/src/main/resources/META-INF/spring/mailbox-locker.xml
 (original)
+++ 
james/mailbox/trunk/spring/src/main/resources/META-INF/spring/mailbox-locker.xml
 Wed Jul  1 09:47:31 2015
@@ -25,4 +25,6 @@
 
     <bean id="jvm-locker" 
class="org.apache.james.mailbox.store.JVMMailboxPathLocker"/>
 
+    <bean id="no-locker" 
class="org.apache.james.mailbox.store.NoMailboxPathLocker"/>
+
 </beans>

Added: 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/NoMailboxPathLocker.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/NoMailboxPathLocker.java?rev=1688612&view=auto
==============================================================================
--- 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/NoMailboxPathLocker.java
 (added)
+++ 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/NoMailboxPathLocker.java
 Wed Jul  1 09:47:31 2015
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.mailbox.store;
+
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxPath;
+
+/**
+ * Some distributed mailboxes do not require any locking ( eg : Cassandra )
+ *
+ * This PathLocker avoid useless locking when these mailboxes are used
+ */
+public class NoMailboxPathLocker extends AbstractMailboxPathLocker {
+
+    @Override
+    protected void lock(MailboxSession session, MailboxPath path, boolean 
writeLock) throws MailboxException {
+
+    }
+
+
+    @Override
+    protected void unlock(MailboxSession session, MailboxPath path, boolean 
writeLock) throws MailboxException {
+
+    }
+
+}
\ No newline at end of file



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

Reply via email to