You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/12/14 09:40:04 UTC

svn commit: r1214109 - in /directory/apacheds/branches/apacheds-txns/core-api/src: main/java/org/apache/directory/server/core/api/ main/java/org/apache/directory/server/core/api/partition/ main/java/org/apache/directory/server/core/api/txn/ test/java/o...

Author: saya
Date: Wed Dec 14 08:40:04 2011
New Revision: 1214109

URL: http://svn.apache.org/viewvc?rev=1214109&view=rev
Log:
added txn handle so that paged search can store a ref to the txn context

Added:
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java
Modified:
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java
    directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java?rev=1214109&r1=1214108&r2=1214109&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java Wed Dec 14 08:40:04 2011
@@ -33,11 +33,14 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.event.EventService;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.journal.Journal;
+import org.apache.directory.server.core.api.partition.OperationExecutionManager;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
 import org.apache.directory.server.core.api.schema.SchemaPartition;
 import org.apache.directory.server.core.api.subtree.SubentryCache;
 import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.api.txn.TxnManager;
 import org.apache.directory.shared.ldap.codec.api.LdapApiService;
 import org.apache.directory.shared.ldap.model.csn.Csn;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -57,6 +60,12 @@ import org.apache.directory.shared.ldap.
 public interface DirectoryService extends ServerEntryFactory
 {
     String JNDI_KEY = DirectoryService.class.getName();
+    
+    /** Default txn log file size */
+    long TXN_LOG_FILE_SIZE = 1 << 27;
+    
+    /** Default txn log buffer size */
+    int TXN_LOG_BUFFER_SIZE = 1 << 22;
 
     /**
      * Reverts the server's state to an earlier revision.  Note that the revsion number
@@ -608,4 +617,13 @@ public interface DirectoryService extend
      * @return the Dn factory
      */
     DnFactory getDnFactory();
+    
+      
+    TxnManager getTxnManager();
+    
+    
+    TxnLogManager getTxnLogManager();   
+    
+    
+    OperationExecutionManager getOperationExecutionManager();
 }

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java?rev=1214109&r1=1214108&r2=1214109&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java Wed Dec 14 08:40:04 2011
@@ -81,6 +81,7 @@ public abstract class AbstractPartition 
         }
         catch ( Exception e )
         {
+            e.printStackTrace();
             throw new LdapOtherException( e.getMessage(), e );
         }
         finally

Added: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java?rev=1214109&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java (added)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java Wed Dec 14 08:40:04 2011
@@ -0,0 +1,28 @@
+/*
+ *  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.directory.server.core.api.txn;
+
+/*
+ * A handle for clients to use to communicate with txn layer.
+ */
+public interface TxnHandle
+{
+
+}

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java?rev=1214109&r1=1214108&r2=1214109&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java Wed Dec 14 08:40:04 2011
@@ -27,7 +27,7 @@ import java.util.Comparator;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface TxnManager<ID>
+public interface TxnManager
 {
     /**
      * Starts a new txn and associates it with the current thread.
@@ -53,5 +53,37 @@ public interface TxnManager<ID>
      * @throws Exception
      */
     void abortTransaction() throws Exception;
+    
+    
+    /**
+     * Suspends the execution of the current txn and returns 
+     * a handle to it.
+     * 
+     * @return handle for the current txn
+     */
+    TxnHandle suspendCurTxn();
+    
+    
+    /**
+     * Resumes the execution of the txn corresponding to the given
+     * handle
+     *
+     * @param txnHandle handle for the txn to resume.
+     */
+    void resumeTxn( TxnHandle txnHandle);
+    
+    
+    /**
+     * returns a handle for the current txn
+     *
+     * @return handle for the current txn
+     */
+    TxnHandle getCurTxn();
+    
+    
+    /**
+     * Flushes the committed txns to partitions.
+     */
+    void applyPendingTxns();
   
 }

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java?rev=1214109&r1=1214108&r2=1214109&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java Wed Dec 14 08:40:04 2011
@@ -36,11 +36,14 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.event.EventService;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.journal.Journal;
+import org.apache.directory.server.core.api.partition.OperationExecutionManager;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
 import org.apache.directory.server.core.api.schema.SchemaPartition;
 import org.apache.directory.server.core.api.subtree.SubentryCache;
 import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.api.txn.TxnManager;
 import org.apache.directory.shared.ldap.codec.api.LdapApiService;
 import org.apache.directory.shared.ldap.model.csn.Csn;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -600,4 +603,23 @@ public class MockDirectoryService implem
     {
         // TODO Auto-generated method stub
     }
-}
+    
+    
+    public TxnManager getTxnManager()
+    {
+        return null;
+    }
+    
+    
+    public TxnLogManager getTxnLogManager()
+    {
+        return null;
+    }
+    
+    
+    public OperationExecutionManager getOperationExecutionManager()
+    {
+        return null;
+    }
+    
+ }