XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • JBossAS-4.0.4.GA
    • JBossAS-3.2.6 Final
    • CMP service
    • None

    Description

      SourceForge Submitter: loubyansky .
      First of all, flushCache() will actually flush the cache.
      It will try to passivate the cached instances. Those
      instances that are in use (enlisted in transactions)
      won't be passivated but still will be evicted from the
      cache. Nevertheless, the instances remain associated
      with the transaction and are scheduled for
      synchronization at commit, i.e. they will be updated in
      the database with changes made in the tx.
      What is dangerous and might be a bug is that if you
      find the flushed instance with the finder in the same
      tx, this found instance will be put into the cache
      (with the data from the db, i.e. stale data) and
      associated with the tx. So, there will be two
      (different) versions of the same instance and both will
      be synchronized at transaction commit. Last commit wins.

      You can see it with the following code:

      ALocal a =
      AUtil.getLocalHome().findByPrimaryKey(new APK(new
      Long(1), "avoka"));
      a.setName2("NAME2");

      MBeanServer server =
      MBeanServerLocator.locateJBoss();
      ObjectName container = new
      ObjectName("jboss.j2ee:service=EJB,jndiName=A");
      server.invoke(container, "flushCache", null, null);

      a = AUtil.getLocalHome().findByPrimaryKey(new
      APK(new Long(1), "avoka"));
      log.info("a.name2: " + a.getName2());
      a.setName2("NAME3");

      http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839187#3839187

      Attachments

        Activity

          People

            olubyans@redhat.com Alexey Loubyansky
            sourceforge-user SourceForge legacy user (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: