Re: Cay-256 / object invalidation

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Oct 12 2005 - 13:10:12 EDT

  • Next message: Andrus Adamchik: "Re: cayenne/src/tests/resources/test-resources cayenne.xml,1.30,1.31 testmap.map.xml,1.52,1.53"

    Chris, as I mentioned before, I've been sick since for the last week,
    so I'm now quite far behind in my paying work. The only thing I can
    suggest is trying your test against 1.2 and seeing if you see the same
    behavior. I still suspect it might be a race condition, but I can't
    investigate it myself. The original patch was against 1.1RC2, and as
    far as I know, the problem hasn't popped back up in my application.
    But maybe it wasn't fixed for all cases.

    On 10/11/05, Cris Daniluk <cris.danilu..mail.com> wrote:
    > I put a sleep before and after the invalidate, to be safe - still
    > seeing the same behavior.
    >
    > A patch is attached with the test changes I made.
    >
    > On 10/11/05, Mike Kienenberger <mkienen..mail.com> wrote:
    > > One thing to keep in mind is that there's a race condition here. It
    > > takes time to propagate the change.
    > >
    > > What happens if you put in a "sleep(5000)" after the invalidate?
    > >
    > > -Mike
    > >
    > > On 10/11/05, Cris Daniluk <cris.danilu..mail.com> wrote:
    > > > Easier to explain through code probably...
    > > >
    > > > public void testInvalidateObjectsMergeSnapshots() throws Exception{
    > > >
    > > > TestCaseDataFactory.createArtist(
    > > > "testInvalidateObjectsMergeSnapshots");
    > > >
    > > > DataContext altContext = createAltContext();
    > > >
    > > > // Retrieve the artist in both contexts...
    > > > Artist artist = fetchArtist("testInvalidateObjectsMergeSnapshots");
    > > > Artist altArtist =
    > > > fetchArtist("testInvalidateObjectsMergeSnapshots", altContext);
    > > >
    > > > assertEquals(artist.getPersistenceState(),
    > > > altArtist.getPersistenceState());
    > > >
    > > > Date now = new Date();
    > > > artist.setDateOfBirth(now);
    > > > altArtist.setArtistName("nameToAccept");
    > > >
    > > > altContext.commitChanges();
    > > >
    > > > context.invalidateObjects(Collections.singleton(artist));
    > > > assertEquals("nameToAccept", artist.getArtistName());
    > > >
    > > > }
    > > >
    > > > This doesn't work. In other words, when I invalidate an object, it
    > > > reverts to the original snapshot. It does NOT refresh the snapshot
    > > > from the database.
    > > >
    > > >
    > > > On 10/11/05, Mike Kienenberger <mkienen..mail.com> wrote:
    > > > > Not quite sure what you're asking. (Sorry for the late response, but
    > > > > I've been sick).
    > > > >
    > > > > On 10/6/05, Cris Daniluk <cris.danilu..mail.com> wrote:
    > > > > > While applying the patch for Cay-256 to the 1.1 branch, I noticed that
    > > > > > it doesn't seem to be behaving as advertised. Basically, it seems like
    > > > > > the invalidated object is falling back on its original snapshot,
    > > > > > rather than refetching from the database.
    > > > > >
    > > > > > Is this correct behavior? Based on the bug note in Cay-256, I'm led to
    > > > > > believe otherwise..
    > > > > >
    > > > > > Cris
    > > > > >
    > > > >
    > > >
    > >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Oct 12 2005 - 13:10:14 EDT