Re: cache synchronization

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Dec 15 2005 - 04:04:23 EST

  • Next message: Andrus Adamchik: "Re: bulk update"

    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 - 04:04:26 EST