Package org.apache.marmotta.ldcache.api

Examples of org.apache.marmotta.ldcache.api.LDCachingConnection.commit()


                    con.removeCacheEntry(entry.getResource());
                    con.addCacheEntry(entry.getResource(),entry);
                }

                con.commit();
            } catch(RepositoryException ex) {
                con.rollback();
            } finally {
                con.close();
            }
View Full Code Here


                // 2. check whether the resource has a cache entry; if no, goto 4
                entry = cacheConnection.getCacheEntry(resource);

                // commit/close the connection, the retrieveResource method takes too long to hold the DB connection open
                cacheConnection.commit();

                // 3. check whether the expiry time of the cache entry has passed; if no, returns immediately
                if(!forceRefresh && entry != null && entry.getExpiryDate().after(new Date())) {
                    log.debug("not refreshing resource {}, as the cached entry is not yet expired",resource);
                    return;
View Full Code Here

                        }
                        newEntry.setTripleCount(count);

                        cacheConnection1.removeCacheEntry(resource);
                        cacheConnection1.addCacheEntry(resource, newEntry);
                        cacheConnection1.commit();
                    } catch (RepositoryException e) {
                        log.error("repository error while refreshing the remote resource {} from the Linked Data Cloud", resource, e);
                        cacheConnection1.rollback();
                    } finally {
                        cacheConnection1.close();
View Full Code Here

                cacheConnection2.begin();
                try {
                    cacheConnection2.removeCacheEntry(resource);
                    cacheConnection2.addCacheEntry(resource, newEntry);

                    cacheConnection2.commit();
                    log.error("refreshing the remote resource {} from the Linked Data Cloud failed ({})",resource,e.getMessage());
                    //log.info("exception was:",e);
                    return;
                } catch (RepositoryException ex) {
                    log.error("repository error while refreshing the remote resource {} from the Linked Data Cloud", resource, ex);
View Full Code Here

                                con.begin();

                                con.removeCacheEntry(next.getResource());
                                con.addCacheEntry(next.getResource(), next);

                                con.commit();
                            } catch(RepositoryException ex) {
                                con.rollback();
                            } finally {
                                con.close();
                            }
View Full Code Here

            Statement stmt2 = con.getValueFactory().createStatement(subject2,predicate,object2);

            con.add(stmt1);
            con.add(stmt2);

            con.commit();

            con.begin();
            CacheEntry entry1 = new CacheEntry();
            entry1.setExpiryDate(new Date(System.currentTimeMillis()+1000*60));
            entry1.setLastRetrieved(new Date());
View Full Code Here

            entry1.setLastRetrieved(new Date());
            entry1.setUpdateCount(1);
            entry1.setResource(subject1);
            entry1.setTripleCount(1);
            con.addCacheEntry(subject1, entry1);
            con.commit();

            Assert.assertTrue(backend.isCached(subject1.stringValue()));
            Assert.assertFalse(backend.isCached(subject2.stringValue()));
            Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
            Assert.assertEquals(0,asList(backend.listExpiredEntries()).size());
View Full Code Here

            entry2.setUpdateCount(1);
            entry2.setResource(subject2);
            entry2.setTripleCount(1);
            con.addCacheEntry(subject2,entry2);

            con.commit();

            Assert.assertTrue(backend.isCached(subject1.stringValue()));
            Assert.assertTrue(backend.isCached(subject2.stringValue()));
            Assert.assertEquals(2,asList(backend.listCacheEntries()).size());
            Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
View Full Code Here

            Assert.assertEquals(2,asList(backend.listCacheEntries()).size());
            Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());

            con.begin();
            con.removeCacheEntry(subject1);
            con.commit();

            Assert.assertFalse(backend.isCached(subject1.stringValue()));
            Assert.assertTrue(backend.isCached(subject2.stringValue()));
            Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
            Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
View Full Code Here

            Statement stmt2 = con.getValueFactory().createStatement(subject2,predicate,object2);

            con.add(stmt1);
            con.add(stmt2);

            con.commit();

            con.begin();
            CacheEntry entry1 = new CacheEntry();
            entry1.setExpiryDate(new Date(System.currentTimeMillis()+1000*60));
            entry1.setLastRetrieved(new Date());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.