Hi,
I'm running objectdb in server mode, config as it comes out of the box.
In this case the database is being used as a queue with multiple seperate processes, each with multiple threads, writing messages. The message is split into a lightweight metadata message to allow fast searching and a more heavy weight data message. The put methods are shown below. The message is made up of an id, insert-time, priority and the payload is a large string.
public void put(Message msg) { ObjectDbMessage objectDbMessage = msg instanceof ObjectDbMessage ? (ObjectDbMessage)msg : ObjectDbMessage.CreateObjectDbMessage(msg); put(_dataEmf, objectDbMessage); synchronized(_queueEmf) { put(_queueEmf, objectDbMessage.getMessageMetadata()); _notificationQueue.add(1); } } public void put(EntityManagerFactory emf, Object obj) { EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); try { em.persist(obj); em.getTransaction().commit(); } catch(Exception e) { if(em.getTransaction().isActive()) em.getTransaction().rollback(); throw new ApplicationException("Error putting message on objectdb queue", e); } finally { em.close(); } }
I've tested this extensively in embedded mode and it works fine with many writers and readers. However, in server mode I'm occasionally seeing the error below. It doesn't occur frequently and I've been unable to recreate with a dedicated test as yet (I will post here if I do). I am worried about potentially losing messages though so I was hoping you might be able to shed some light on what is happening.
rbccm.felix.framework.ApplicationException: Error putting message on objectdb queue at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.put(Unknown Source) at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.put(Unknown Source) at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.put(Unknown Source) at rbccm.felix.gridservice.workflow.WorkflowAdminCallbackService.workflowCallback(Unknown Source) at rbccm.digest.workflow.execution.WorkflowRunner.workflowCallback(Unknown Source) at rbccm.digest.workflow.execution.WorkflowRunner.startWorkflow(Unknown Source) at rbccm.felix.gridservice.workflow.WorkflowService.process(Unknown Source) at rbccm.felix.gridservice.workflow.WorkflowService.process(Unknown Source) at rbccm.felix.gridservice.workflow.WorkflowService.process(Unknown Source) at rbccm.felix.framework.service.ServiceRunner.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) Caused by: com.objectdb.o._RollbackException: Failed to commit transaction: $1 at com.objectdb.o.JPE.g(JPE.java:89) at com.objectdb.o.ERR.f(ERR.java:59) at com.objectdb.o.OBC.onObjectDBError(OBC.java:1443) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277) ... 11 more Caused by: java.lang.NullPointerException at com.objectdb.o.TVR.c(TVR.java:67) at com.objectdb.o.TVR.b(TVR.java:51) at com.objectdb.o.TYM.ac(TYM.java:517) at com.objectdb.o.TYM.aa(TYM.java:441) at com.objectdb.o.TYM.am(TYM.java:760) at com.objectdb.o.TYM.aq(TYM.java:845) at com.objectdb.o.EPR.Um(EPR.java:77) at com.objectdb.o.UML.w(UML.java:544) at com.objectdb.o.MMM.ad(MMM.java:975) at com.objectdb.o.UTY.visitRefs(UTY.java:1143) at com.objectdb.o.TVS.j(TVS.java:169) at com.objectdb.o.TVS.cascade(TVS.java:146) at com.objectdb.o.STA.Q(STA.java:476) at com.objectdb.o.STM.D(STM.java:393) 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) ... 11 more
Thanks for your help