Updated Branches:
  refs/heads/develop 883aa7834 -> 9ef140d91

first working implementation of query caching


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/c44b5703
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/c44b5703
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/c44b5703

Branch: refs/heads/develop
Commit: c44b5703a14153966a6a090563565f9b7881bddf
Parents: f94823e
Author: Sebastian Schaffert <[email protected]>
Authored: Fri Dec 20 14:46:17 2013 +0100
Committer: Sebastian Schaffert <[email protected]>
Committed: Fri Dec 20 14:46:17 2013 +0100

----------------------------------------------------------------------
 .../caching/iteration/BufferingIteration.java   |   2 +-
 .../caching/iteration/CachingIteration.java     |   6 +
 .../kiwi/caching/sail/KiWiCachingSail.java      |   9 +
 .../caching/sail/KiWiCachingSailConnection.java | 247 +++++++++++++------
 .../GeronimoTransactionManagerLookup.java       |   4 +-
 .../KiWiCachingRepositoryConnectionTest.java    |   2 -
 .../caching/test/KiWiCachingRepositoryTest.java |   2 -
 .../marmotta/kiwi/caching/KiWiCacheManager.java |   2 +
 8 files changed, 189 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/BufferingIteration.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/BufferingIteration.java
 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/BufferingIteration.java
index 9a87df4..a0d02ff 100644
--- 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/BufferingIteration.java
+++ 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/BufferingIteration.java
@@ -24,7 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Add file description here!
+ * An iterator that buffers iteration results up to a configurable limit.
  *
  * @author Sebastian Schaffert ([email protected])
  */

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/CachingIteration.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/CachingIteration.java
 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/CachingIteration.java
index 067e00b..255ac00 100644
--- 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/CachingIteration.java
+++ 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/iteration/CachingIteration.java
@@ -20,6 +20,8 @@ package org.apache.marmotta.kiwi.caching.iteration;
 import info.aduna.iteration.CloseableIteration;
 import info.aduna.iteration.CloseableIterationBase;
 import info.aduna.iteration.CloseableIteratorIteration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.List;
 
@@ -30,6 +32,8 @@ import java.util.List;
  */
 public class CachingIteration<E,X extends Exception> extends 
CloseableIterationBase<E,X> implements CloseableIteration<E,X> {
 
+    private static Logger log = 
LoggerFactory.getLogger(CachingIteration.class);
+
     private CloseableIteration<E,X> wrapped;
 
     private CacheFunction<E> cacheFunction;
@@ -40,8 +44,10 @@ public class CachingIteration<E,X extends Exception> extends 
CloseableIterationB
 
         List<E> cached = cacheFunction.getResult();
         if(cached != null) {
+            log.debug("cache hit, using iterator over cached result 
(size={})!", cached.size());
             this.wrapped = new CloseableIteratorIteration<>(cached.iterator());
         } else {
+            log.debug("cache miss, querying backend!");
             this.wrapped = producer.getIteration();
         }
     }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSail.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSail.java
 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSail.java
index 302cb43..3870e78 100644
--- 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSail.java
+++ 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSail.java
@@ -23,8 +23,10 @@ import org.apache.marmotta.kiwi.sail.KiWiStore;
 import org.infinispan.Cache;
 import org.infinispan.configuration.cache.Configuration;
 import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.cache.VersioningScheme;
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.transaction.TransactionMode;
+import org.infinispan.util.concurrent.IsolationLevel;
 import org.openrdf.sail.NotifyingSail;
 import org.openrdf.sail.NotifyingSailConnection;
 import org.openrdf.sail.Sail;
@@ -90,10 +92,17 @@ public class KiWiCachingSail extends NotifyingSailWrapper {
     private Cache getQueryCache() {
         if(!cacheManager.cacheExists(QUERY_CACHE)) {
             Configuration tripleConfiguration = new 
ConfigurationBuilder().read(cacheManager.getDefaultCacheConfiguration())
+                    .storeAsBinary()
                     .transaction()
                         .transactionMode(TransactionMode.TRANSACTIONAL)
                         .transactionManagerLookup(new 
GeronimoTransactionManagerLookup())
                         .cacheStopTimeout(1, TimeUnit.SECONDS)
+                    .locking()
+                        .isolationLevel(IsolationLevel.READ_COMMITTED)
+                        .concurrencyLevel(5)
+                    .versioning()
+                        .enabled(true)
+                        .scheme(VersioningScheme.SIMPLE)
                     .eviction()
                     .   maxEntries(configuration.getMaxCacheSize())
                     .expiration()

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSailConnection.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSailConnection.java
 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSailConnection.java
index 21ac100..aa47055 100644
--- 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSailConnection.java
+++ 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/sail/KiWiCachingSailConnection.java
@@ -22,6 +22,7 @@ import com.google.common.collect.Lists;
 import info.aduna.iteration.CloseableIteration;
 import info.aduna.iteration.Iteration;
 import info.aduna.iteration.UnionIteration;
+import org.apache.geronimo.transaction.manager.TransactionImpl;
 import org.apache.marmotta.commons.sesame.tripletable.IntArray;
 import org.apache.marmotta.kiwi.caching.iteration.BufferingIteration;
 import org.apache.marmotta.kiwi.caching.iteration.CachingIteration;
@@ -33,8 +34,8 @@ import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.model.impl.URIImpl;
 import org.openrdf.sail.NotifyingSailConnection;
+import org.openrdf.sail.SailConnectionListener;
 import org.openrdf.sail.SailException;
-import org.openrdf.sail.UpdateContext;
 import org.openrdf.sail.helpers.NotifyingSailConnectionWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,11 +45,18 @@ import java.nio.IntBuffer;
 import java.util.*;
 
 /**
- * Add file description here!
+ * A sail connection with Infinispan caching support. It will dynamically 
cache getStatements results up to a certain
+ * result size and invalidate the cache on updates.
+ *
+ * <p/>
+ * Since Infinispan uses JTA for transaction management, we need to align 
Sesame transactions with JTA. JTA transactions
+ * are associated per-thread, while Sesame transactions are per-connection. 
This makes this combination a bit tricky:
+ * every time a relevant method on the sesame connection is called we need to 
suspend the existing thread transaction
+ * and resume the connection that is associated with the connection.
  *
  * @author Sebastian Schaffert ([email protected])
  */
-public class KiWiCachingSailConnection extends NotifyingSailConnectionWrapper {
+public class KiWiCachingSailConnection extends NotifyingSailConnectionWrapper 
implements SailConnectionListener {
 
     private static Logger log = 
LoggerFactory.getLogger(KiWiCachingSailConnection.class);
 
@@ -59,17 +67,32 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
 
     private int limit = 150;
 
+    private Transaction tx;
+
+    private long connectionId;
+
+    private static long connectionIdCounter = 0;
+
     public KiWiCachingSailConnection(NotifyingSailConnection wrappedCon, 
Cache<IntArray, List<Statement>> queryCache, int limit) {
         super(wrappedCon);
 
         this.queryCache = queryCache;
         this.limit      = limit;
 
+        this.addConnectionListener(this);
+
+        connectionId = ++connectionIdCounter;
+
     }
 
 
     @Override
     public CloseableIteration<? extends Statement, SailException> 
getStatements(final Resource subj, final URI pred, final Value obj, final 
boolean includeInferred, final Resource... contexts) throws SailException {
+        if(tx != null) {
+            log.debug("CONN({}) LIST: listing statements for transaction: {}", 
connectionId, ((TransactionImpl) tx).getTransactionKey());
+        } else {
+            log.debug("CONN({}) LIST: listing statements (no transaction)", 
connectionId);
+        }
         List<Iteration<? extends Statement, SailException>> cResults = new 
ArrayList<>(contexts.length + 1);
         for(final Resource context : resolveContexts(contexts)) {
             cResults.add(new CachingIteration<>(
@@ -81,7 +104,8 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
 
                         @Override
                         public void cacheResult(List<Statement> buffer) {
-                            
cacheTriples(subj,pred,obj,context,includeInferred,buffer);
+                            log.debug("CONN({}) CACHE: caching result for 
query ({},{},{},{},{}): {}", connectionId, subj, pred, obj, context, 
includeInferred, buffer);
+                            cacheTriples(subj, pred, obj, context, 
includeInferred, buffer);
                         }
                     },
                     new CachingIteration.BufferingIterationProducer<Statement, 
SailException>() {
@@ -97,62 +121,58 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
 
     }
 
-    @Override
-    public void addStatement(Resource subj, URI pred, Value obj, Resource... 
contexts) throws SailException {
-        tripleUpdated(subj, pred, obj, resolveContexts(contexts));
-
-        super.addStatement(subj, pred, obj, contexts);
-    }
-
-    @Override
-    public void removeStatements(Resource subj, URI pred, Value obj, 
Resource... contexts) throws SailException {
-        // TODO: too aggressive, but currently we cannot remove with wildcards
-        queryCache.clear();
-
-        super.removeStatements(subj, pred, obj, contexts);
-    }
-
-    @Override
-    public void addStatement(UpdateContext modify, Resource subj, URI pred, 
Value obj, Resource... contexts) throws SailException {
-        tripleUpdated(subj, pred, obj, resolveContexts(contexts));
-
-        super.addStatement(modify, subj, pred, obj, contexts);
-    }
 
+    /**
+     * Notifies the listener that a statement has been added in a transaction
+     * that it has registered itself with.
+     *
+     * @param st The statement that was added.
+     */
     @Override
-    public void removeStatement(UpdateContext modify, Resource subj, URI pred, 
Value obj, Resource... contexts) throws SailException {
-        // TODO: too aggressive, but currently we cannot remove with wildcards
-        queryCache.clear();
-
-        super.removeStatement(modify, subj, pred, obj, contexts);
+    public void statementAdded(Statement st) {
+        resumeTransaction();
+        log.debug("CONN({}) ADD: updating cache for statement {} (transaction: 
{})", connectionId, st, ((TransactionImpl) tx).getTransactionKey());
+        if(st.getContext() == null) {
+            tripleUpdated(st.getSubject(), st.getPredicate(), st.getObject(), 
Collections.singleton((Resource)defaultContext));
+        } else {
+            tripleUpdated(st.getSubject(), st.getPredicate(), st.getObject(), 
Collections.singleton(st.getContext()));
+        }
     }
 
-
+    /**
+     * Notifies the listener that a statement has been removed in a transaction
+     * that it has registered itself with.
+     *
+     * @param st The statement that was removed.
+     */
     @Override
-    public void clear(Resource... contexts) throws SailException {
-        // TODO: too aggressive, but currently we cannot remove with wildcards
-        queryCache.clear();
-
-        super.clear(contexts);
+    public void statementRemoved(Statement st) {
+        log.debug("CONN({}) DEL: updating cache for statement {} (transaction: 
{})", connectionId, st, ((TransactionImpl)tx).getTransactionKey());
+        resumeTransaction();
+        if(st.getContext() == null) {
+            tripleUpdated(st.getSubject(), st.getPredicate(), st.getObject(), 
Collections.singleton((Resource)defaultContext));
+        } else {
+            tripleUpdated(st.getSubject(), st.getPredicate(), st.getObject(), 
Collections.singleton(st.getContext()));
+        }
     }
 
     @Override
     public void begin() throws SailException {
         super.begin();
 
-        try {
-            queryCache.getAdvancedCache().getTransactionManager().begin();
-        } catch (NotSupportedException | SystemException e) {
-            log.error("error starting cache transaction: ",e);
-        }
+        resumeTransaction();
     }
 
     @Override
     public void commit() throws SailException {
+        TransactionManager txmgr = 
queryCache.getAdvancedCache().getTransactionManager();
         try {
-            queryCache.getAdvancedCache().getTransactionManager().commit();
+            resumeTransaction();
+            log.debug("CONN({}) COMMIT: transaction: {}", connectionId, 
((TransactionImpl) tx).getTransactionKey());
+            txmgr.commit();
+            closeTransaction();
         } catch (RollbackException | HeuristicMixedException | 
HeuristicRollbackException | SystemException e) {
-            log.error("error committing cache transaction: ",e);
+            log.error("error committing cache transaction: ", e);
         }
 
         super.commit();
@@ -160,8 +180,11 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
 
     @Override
     public void rollback() throws SailException {
+        TransactionManager txmgr = 
queryCache.getAdvancedCache().getTransactionManager();
         try {
-            queryCache.getAdvancedCache().getTransactionManager().rollback();
+            resumeTransaction();
+            txmgr.rollback();
+            closeTransaction();
         } catch (SystemException e) {
             log.error("error rolling back cache transaction: ",e);
         }
@@ -169,16 +192,62 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
         super.rollback();
     }
 
-
     @Override
     public void close() throws SailException {
+        closeTransaction();
+
+        super.close();
+    }
+
+    private void resumeTransaction() {
+        TransactionManager txmgr = 
queryCache.getAdvancedCache().getTransactionManager();
         try {
-            queryCache.getAdvancedCache().getTransactionManager().suspend();
-        } catch (SystemException e) {
-            log.error("error suspending transaction",e);
+            // cases:
+            // 1. there is a transaction in this connection, the transaction 
is active, and associated with the current
+            //    thread -> nothing to do
+            // 2. there is a transaction in this connection, the transaction 
is active, bit another transactionis 
+            //    associated with the current thread -> suspend thread 
transaction, resume connection transaction
+            // 3. there is no transaction in this connection, or the 
transaction in this connection is invalid
+            //    -> create and start new transaction
+            if(tx != null && tx.getStatus() == Status.STATUS_ACTIVE && 
txmgr.getTransaction() == tx) {
+                log.debug("CONN({}) RESUME: using active transaction: {}, 
status {}", connectionId, ((TransactionImpl)tx).getTransactionKey(), 
tx.getStatus());
+            } else if(tx != null && tx.getStatus() == Status.STATUS_ACTIVE && 
txmgr.getTransaction() != tx) {
+                txmgr.suspend();
+                txmgr.resume(tx);
+
+                log.debug("CONN({}) RESUME: resumed transaction: {}, status 
{}", connectionId, ((TransactionImpl)tx).getTransactionKey(), tx.getStatus());
+            } else {
+                if(txmgr.getTransaction() != null) {
+                    Transaction old = txmgr.suspend();
+                    log.debug("CONN({}) BEGIN: suspended transaction not 
belonging to this connection: {}", connectionId, 
((TransactionImpl)old).getTransactionKey());
+                }
+                txmgr.begin();
+                tx = txmgr.getTransaction();
+
+                log.debug("CONN({}) BEGIN: created and started new 
transaction: {}", connectionId, ((TransactionImpl)tx).getTransactionKey());
+
+            }
+
+
+        } catch (NotSupportedException | SystemException | 
InvalidTransactionException e) {
+            log.error("error resuming transaction");
         }
+    }
 
-        super.close();
+    private void closeTransaction() {
+        TransactionManager txmgr = 
queryCache.getAdvancedCache().getTransactionManager();
+        try {
+            if(tx != null && txmgr.getTransaction() == tx) {
+                log.debug("CONN({}) CLOSE: closing transaction: {}", 
connectionId, ((TransactionImpl)tx).getTransactionKey());
+                if(tx.getStatus() == Status.STATUS_ACTIVE) {
+                    tx.commit();
+                }
+                txmgr.suspend();
+                tx = null;
+            }
+        } catch (RollbackException | HeuristicMixedException | 
HeuristicRollbackException | SystemException e) {
+            log.error("error while closing transaction", e);
+        }
     }
 
     private List<Resource> resolveContexts(Resource... contexts) {
@@ -202,10 +271,19 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
      */
     @SuppressWarnings("unchecked")
     private List<Statement> listTriples(Resource subject, URI property, Value 
object, Resource context, boolean inferred) {
+        boolean implicitTx = tx == null;
+        resumeTransaction();
+
         IntArray key = 
createCacheKey(subject,property,object,context,inferred);
-        if(queryCache.get(key) != null) return queryCache.get(key);
-        else
-            return null;
+        try {
+            if(queryCache.get(key) != null) return queryCache.get(key);
+            else
+                return null;
+        } finally {
+            if(implicitTx) {
+                closeTransaction();
+            }
+        }
     }
 
 
@@ -220,40 +298,49 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
      * @param result   the result of the triple query to cache
      */
     private void cacheTriples(Resource subject, URI property, Value object, 
Resource context, boolean inferred, List<Statement> result) {
+        boolean implicitTx = tx == null;
 
-        // cache the query result
-        IntArray key = 
createCacheKey(subject,property,object,context,inferred);
-        queryCache.putAsync(key, result);
-
-        // cache the nodes of the triples and the triples themselves
-        Set<Value> nodes = new HashSet<Value>();
-        for(Statement stmt : result) {
-            if(stmt instanceof KiWiTriple) {
-                KiWiTriple triple = (KiWiTriple)stmt;
-                Collections.addAll(nodes, new Value[]{triple.getSubject(), 
triple.getObject(), triple.getPredicate(), triple.getContext()});
-                queryCache.putAsync(createCacheKey(triple.getSubject(), 
triple.getPredicate(), triple.getObject(), triple.getContext(), 
triple.isInferred()), ImmutableList.of(stmt));
+        resumeTransaction();
+
+        try {
+            // cache the query result
+            IntArray key = 
createCacheKey(subject,property,object,context,inferred);
+            queryCache.putAsync(key, result);
+
+            // cache the nodes of the triples and the triples themselves
+            Set<Value> nodes = new HashSet<Value>();
+            for(Statement stmt : result) {
+                if(stmt instanceof KiWiTriple) {
+                    KiWiTriple triple = (KiWiTriple)stmt;
+                    Collections.addAll(nodes, new Value[]{triple.getSubject(), 
triple.getObject(), triple.getPredicate(), triple.getContext()});
+                    queryCache.putAsync(createCacheKey(triple.getSubject(), 
triple.getPredicate(), triple.getObject(), triple.getContext(), 
triple.isInferred()), ImmutableList.of(stmt));
+                }
             }
-        }
 
-        // special optimisation: when only the subject (and optionally 
context) is given, we also fill the caches for
-        // all property values
-        if(subject != null && property == null && object == null) {
-            HashMap<URI,List<Statement>> properties = new HashMap<>();
-            for(Statement triple : result) {
-                List<Statement> values = properties.get(triple.getPredicate());
-                if(values == null) {
-                    values = new LinkedList<>();
-                    properties.put(triple.getPredicate(),values);
+            // special optimisation: when only the subject (and optionally 
context) is given, we also fill the caches for
+            // all property values
+            if(subject != null && property == null && object == null) {
+                HashMap<URI,List<Statement>> properties = new HashMap<>();
+                for(Statement triple : result) {
+                    List<Statement> values = 
properties.get(triple.getPredicate());
+                    if(values == null) {
+                        values = new LinkedList<>();
+                        properties.put(triple.getPredicate(),values);
+                    }
+                    values.add(triple);
+                }
+                for(Map.Entry<URI,List<Statement>> entry : 
properties.entrySet()) {
+                    IntArray key2 = 
createCacheKey(subject,entry.getKey(),null,context,inferred);
+                    queryCache.putAsync(key2, entry.getValue());
                 }
-                values.add(triple);
             }
-            for(Map.Entry<URI,List<Statement>> entry : properties.entrySet()) {
-                IntArray key2 = 
createCacheKey(subject,entry.getKey(),null,context,inferred);
-                queryCache.putAsync(key2, entry.getValue());
+
+        } finally {
+            if(implicitTx) {
+                closeTransaction();
             }
         }
 
-
     }
 
 
@@ -276,6 +363,10 @@ public class KiWiCachingSailConnection extends 
NotifyingSailConnectionWrapper {
         queryCache.remove(createCacheKey(null,null,null,null,false));
         queryCache.remove(createCacheKey(null,null,null,null,true));
 
+        queryCache.remove(createCacheKey(null,null,null,defaultContext,false));
+        queryCache.remove(createCacheKey(null,null,null,defaultContext,true));
+
+
         // remove all possible combinations of this triple as they may appear 
in the cache
         queryCache.remove(createCacheKey(subject,null,null,null,false));
         queryCache.remove(createCacheKey(subject,null,null,null,true));

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/transaction/GeronimoTransactionManagerLookup.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/transaction/GeronimoTransactionManagerLookup.java
 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/transaction/GeronimoTransactionManagerLookup.java
index 738b7fa..ad35473 100644
--- 
a/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/transaction/GeronimoTransactionManagerLookup.java
+++ 
b/libraries/kiwi/kiwi-caching/src/main/java/org/apache/marmotta/kiwi/caching/transaction/GeronimoTransactionManagerLookup.java
@@ -17,7 +17,7 @@
 
 package org.apache.marmotta.kiwi.caching.transaction;
 
-import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.infinispan.transaction.lookup.TransactionManagerLookup;
 
 import javax.transaction.TransactionManager;
@@ -39,7 +39,7 @@ public class GeronimoTransactionManagerLookup implements 
TransactionManagerLooku
     @Override
     public TransactionManager getTransactionManager() throws Exception {
         if(manager == null) {
-            manager = new TransactionManagerImpl();
+            manager = new GeronimoTransactionManager();
         }
         return manager;
     }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryConnectionTest.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryConnectionTest.java
 
b/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryConnectionTest.java
index 9edabb4..aaa7d3c 100644
--- 
a/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryConnectionTest.java
+++ 
b/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryConnectionTest.java
@@ -22,7 +22,6 @@ import org.apache.marmotta.kiwi.caching.sail.KiWiCachingSail;
 import org.apache.marmotta.kiwi.config.KiWiConfiguration;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
 import org.apache.marmotta.kiwi.test.junit.KiWiDatabaseRunner;
-import org.junit.Ignore;
 import org.junit.runner.RunWith;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryConnectionTest;
@@ -34,7 +33,6 @@ import org.openrdf.repository.sail.SailRepository;
  *
  */
 @RunWith(KiWiDatabaseRunner.class)
-@Ignore
 public class KiWiCachingRepositoryConnectionTest extends 
RepositoryConnectionTest {
 
     private final KiWiConfiguration config;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryTest.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryTest.java
 
b/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryTest.java
index 90cfd75..9b13279 100644
--- 
a/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryTest.java
+++ 
b/libraries/kiwi/kiwi-caching/src/test/java/org/apache/marmotta/kiwi/caching/test/KiWiCachingRepositoryTest.java
@@ -22,7 +22,6 @@ import org.apache.marmotta.kiwi.caching.sail.KiWiCachingSail;
 import org.apache.marmotta.kiwi.config.KiWiConfiguration;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
 import org.apache.marmotta.kiwi.test.junit.KiWiDatabaseRunner;
-import org.junit.Ignore;
 import org.junit.runner.RunWith;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryTest;
@@ -34,7 +33,6 @@ import org.openrdf.repository.sail.SailRepository;
  *
  */
 @RunWith(KiWiDatabaseRunner.class)
-@Ignore
 public class KiWiCachingRepositoryTest extends RepositoryTest {
 
     private final KiWiConfiguration config;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c44b5703/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java
 
b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java
index 00cf25e..f089ce1 100644
--- 
a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java
+++ 
b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java
@@ -78,6 +78,7 @@ public class KiWiCacheManager {
 
         if(clustered) {
             globalConfiguration = new GlobalConfigurationBuilder()
+                    .classLoader(KiWiCacheManager.class.getClassLoader())
                     .transport()
                         .defaultTransport()
                         .clusterName(config.getClusterName())
@@ -109,6 +110,7 @@ public class KiWiCacheManager {
                     .build();
         } else {
             globalConfiguration = new GlobalConfigurationBuilder()
+                    .classLoader(KiWiCacheManager.class.getClassLoader())
                     .globalJmxStatistics()
                         .jmxDomain("org.apache.marmotta.kiwi")
                         .allowDuplicateDomains(true)

Reply via email to