Home » Support » Forum » Working with a cleared cache

Working with a cleared cache

#1

I'm working on trying to improve the performance of our database processing class and I'm attempting to keep the L1 cache within the PersistenceManager cleared in an effort to reduce its memory footprint. The code snippet below is part of a Callable task that is run repeatedly with a given list of commands. When I run the code as written I start getting the stack traces that are listed.  However, if I comment out the calls to makeTransactionalAll() and evictAll() everything works. Is there something else I can do to the toDelete collection to get it to delete properly if I have cleared the cache?

 

try {
            // Start the transaction
            m_persistenceManager.currentTransaction().begin();
           
            // Query the database for all of the tracks to delete
            String jdoql = getQueryString(deleteCollection);
            Query query = m_persistenceManager.newQuery(getPersistableClass(), jdoql);
            Collection toDelete = (Collection)query.execute();
            m_persistenceManager.makeTransactionalAll(toDelete);
            m_persistenceManager.deletePersistentAll(toDelete);
           
            // add all objects in given map
            m_persistenceManager.makePersistentAll(addCollection);
           
            // Flush the JDO cache
            m_persistenceManager.evictAll();
           
            m_persistenceManager.currentTransaction().commit();
        } finally {
            if(m_persistenceManager.currentTransaction().isActive()) {
                m_persistenceManager.currentTransaction().rollback();
            }
        }

 

[ObjectDB 2.2.9] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) Server VM 1.6.0_26 (on Windows XP 5.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: null
com.objectdb.o.InternalException
at com.objectdb.o.InternalException.f(InternalException.java:236)
at com.objectdb.o.STA.K(STA.java:348)
at com.objectdb.o.RTM.r(RTM.java:132)
at com.objectdb.o.HTB.k(HTB.java:163)
at com.objectdb.o.RTM.w(RTM.java:71)
at com.objectdb.o.ENH.e(ENH.java:354)
at com.objectdb.o.ENH.e(ENH.java:308)
at com.objectdb.o.STM.D(STM.java:404)
at com.objectdb.o.OBM.bH(OBM.java:884)
at com.objectdb.jdo.PMImpl.bH(PMImpl.java:2186)
at com.objectdb.o.OBM.bG(OBM.java:800)
at com.objectdb.o.OBM.bE(OBM.java:715)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:274)
at nuwc.iof.data.AbstractObjectDBDatabase.processCommands(AbstractObjectDBDatabase.java:316)

[ObjectDB 2.2.9] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) Server VM 1.6.0_26 (on Windows XP 5.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: null
com.objectdb.o.InternalException
at com.objectdb.o.InternalException.f(InternalException.java:236)
at com.objectdb.o.STA.K(STA.java:348)
at com.objectdb.o.ENT.w(ENT.java:386)
at com.objectdb.o.OBC.aI(OBC.java:913)
at com.objectdb.o.OBC.UG(OBC.java:821)
at com.objectdb.o.TYR.aH(TYR.java:676)
at com.objectdb.o.TYR.aG(TYR.java:662)
at com.objectdb.o.TYR.completeRead(TYR.java:518)
at com.objectdb.o.TYR.readElement(TYR.java:272)
at com.objectdb.o.UTY.readAndAdjust(UTY.java:1332)
at com.objectdb.o.UMR.readAndAdjust(UMR.java:603)
at peoiws5.track.persistence.track.CvtscTrackLinkBean.__odbReadContent(CvtscTrackLinkBean.java:1)
at com.objectdb.o.MMM.ag(MMM.java:1040)
at com.objectdb.o.UTY.aI(UTY.java:1253)
at com.objectdb.o.UTY.aH(UTY.java:1225)
at com.objectdb.o.ENH.b(ENH.java:99)
at com.objectdb.o.LDR.J(LDR.java:440)
at com.objectdb.o.LDR.j(LDR.java:661)
at com.objectdb.o.RTT.F(RTT.java:263)
at com.objectdb.o.RTT.E(RTT.java:245)
at com.objectdb.o.RST.B(RST.java:169)
at com.objectdb.o.RTT.l(RTT.java:134)
at com.objectdb.o.RST.l(RST.java:24)
at com.objectdb.o.RTT.C(RTT.java:179)
at com.objectdb.o.RST.r(RST.java:110)
at com.objectdb.o.PGT.q(PGT.java:109)
at com.objectdb.o.RST.A(RST.java:93)
at com.objectdb.o.RTT.l(RTT.java:132)
at com.objectdb.o.RST.l(RST.java:24)
at com.objectdb.o.TSK.i(TSK.java:146)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.TSM.e(TSM.java:87)
at com.objectdb.o.MST.UQ(MST.java:547)
at com.objectdb.o.WRA.UQ(WRA.java:256)
at com.objectdb.o.LDR.I(LDR.java:378)
at com.objectdb.o.LDR.H(LDR.java:289)
at com.objectdb.o.OBC.aM(OBC.java:1048)
at com.objectdb.o.OBC.aI(OBC.java:931)
at com.objectdb.o.OBC.UG(OBC.java:802)
at com.objectdb.o.SRB.l(SRB.java:128)
at com.objectdb.o.RSL.p(RSL.java:294)
at com.objectdb.o.RSL.get(RSL.java:154)
at java.util.AbstractList$Itr.next(Unknown Source)
at com.objectdb.o.RSL$q.next(RSL.java:218)
at java.util.AbstractCollection.toArray(Unknown Source)
at com.objectdb.jdo.PMImpl.makeTransactionalAll(PMImpl.java:1340)
at nuwc.iof.data.AbstractObjectDBDatabase.processCommands(AbstractObjectDBDatabase.java:307)
#2

I should note, that while this code is being executed within a Callable task, it's currently being executed by a single threaded Executor so only one thread will be accessing the PersistenceManager at a time. One of my next steps will be to increase the number of threads so if you have any suggestions on what would help in a multi-threaded environment those would be greatly appreciated as well.

#3

It is unclear from the stack trace which callback is invoked (the stack trace seems incomplete). In general, there are many restrictions on code in JPA/JDO lifecycle event callbacks. ObjectDB should produce better error messages, but if the same code works outside the callback method - the solution should be based on using it not in a callback method.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login