R: cache synchronization

From: Claudio Rosati (claudio.rosat..csys.it)
Date: Thu Dec 15 2005 - 08:58:08 EST

  • Next message: Andrus Adamchik: "M9 released"

    Hi Andrus.

    Here what you asked (I've just made a remote modification first, followed by
    a local one. Each modification called 5 times the shouldMergeChanges
    method.):

    ---- SYSTEM.OUT ---------------------------------------------------------

    ...

    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --

    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --
    Object snapshot version: -9223372036854774493
    Row snapshot version: -- snapshotInStore is null --

    ---- SYSTEM.ERR ---------------------------------------------------------

    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)

    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)
    java.lang.Exception: Stack trace
            at java.lang.Thread.dumpStack(Thread.java:1158)
            at
    it.acsys.multimedia.products.cadmus.RecordDocument$1.shouldMergeChanges(Reco
    rdDocument.java:124)
            at
    org.objectstyle.cayenne.access.ObjectStore.processIndirectlyModifiedIDs(Obje
    ctStore.java:1064)
            at
    org.objectstyle.cayenne.access.ObjectStore.snapshotsChanged(ObjectStore.java
    :876)
            at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.objectstyle.cayenne.util.Invocation.fire(Invocation.java:226)
            at
    org.objectstyle.cayenne.event.EventManager$InvocationDispatch.fire(EventMana
    ger.java:429)
            at
    org.objectstyle.cayenne.event.EventManager$DispatchThread.run(EventManager.j
    ava:478)

    -------------------------------------------------------------------------

    Moreover, after some problems having JGroups working, I managed it using
    address 228.8.8.8 and port 45566.
    I hope this can help.

    Claudio

    ------------------------------------
    Advanced Computer Systems S.p.A.
    Claudio Rosati
    Project Manager
    claudio.rosat..csys.it
    via Della Bufalotta 378
    00139 Roma, RM
    Italy
    tel: +39 06 8709 0516
    fax: +39 06 8720 1502
    ------------------------------------
     

    > -----Messaggio originale-----
    > Da: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Inviato: giovedì 15 dicembre 2005 10.04
    > A: cayenne-use..bjectstyle.org
    > Oggetto: Re: cache synchronization
    >
    > Hi Claudio,
    >
    > Looking at the code the only case I can see when a local
    > operation would trigger "finishedMergeChanges" call (inside
    > ObjectStore.retainSnapshot(..)) is when a snapshot for a
    > given object was refreshed in the underlying cache. I am
    > still unclear why this happens in your case, and I suspect a
    > bug in snapshot version handling.
    >
    > Can you possibly do a simple test, adding some debug info to
    > the delegate and try it first with remote modification, and
    > then with a local one, and see what is printed to the console:
    >
    > public boolean shouldMergeChanges ( DataObject object,
    > DataRow snapshotInStore ) {
    > System.out.println("Object snapshot version: " +
    > object.getSnapshotVersion());
    > System.out.println("Row snapshot version: " +
    > snapshotInStore.getVersion());
    >
    > Thread.dumpStack();
    >
    > return true;
    > }
    >
    > Andrus
    >
    >
    > On Dec 14, 2005, at 2:45 PM, Claudio Rosati wrote:
    > > HI all,
    > >
    > > I'm using Cayenne (1.1.3) with jGroups. This is the code
    > I'm using to
    > > inform my user (a flashing message in the application's
    > status bar) of
    > > a modification occurred:
    > >
    > > dataContext.setDelegate(
    > > new DataContextDelegate() {
    > > public void finishedMergeChanges ( DataObject object ) {
    > > ... // Show a flashing message in the status bar.
    > > }
    > > public void finishedProcessDelete ( DataObject object ) {
    > > ; // Nothing to do.
    > > }
    > > public boolean shouldMergeChanges ( DataObject object, DataRow
    > > snapshotInStore ) {
    > > return true;
    > > }
    > > public boolean shouldProcessDelete ( DataObject object ) {
    > > return true;
    > > }
    > > public GenericSelectQuery willPerformSelect (
    > DataContext context,
    > > GenericSelectQuery query ) {
    > > return query;
    > > }
    > > }
    > > );
    > >
    > > The problem is that finishedMergeChanges is called not only when
    > > someone in the net changes the object viewed by my user,
    > but even when
    > > my user does some modification on the object graph.
    > >
    > > There is a way to understand if the call was made locally
    > (in the same
    > > V.M.
    > > where the application is running) or elsewhere (i.e. was caused by
    > > cache synchronization triggered by jgroups).?
    > >
    > > Thanks in advance
    > >
    > > Claudio
    > >
    > > ------------------------------------
    > > Advanced Computer Systems S.p.A.
    > > Claudio Rosati
    > > Project Manager
    > > claudio.rosat..csys.it
    > > via Della Bufalotta 378
    > > 00139 Roma, RM
    > > Italy
    > > tel: +39 06 8709 0516
    > > fax: +39 06 8720 1502
    > > ------------------------------------
    >



    This archive was generated by hypermail 2.0.0 : Thu Dec 15 2005 - 08:58:08 EST