1 Reply Latest reply on Aug 26, 2004 5:54 AM by daeel

    Flush commit option A's cache

    daeel Newbie


      We use jboss 3.2.4 in production with commit option A. It works great but occationaly we need to hand edit some data in the database (maybe once a week maximum). This of course doesn't work very well since the data is cached in JBoss.

      I wonder if there is any way to flush this cache with the JMX interface or by programming directly to the jboss API or by some other means without restarting JBoss? It doesn't matter if it is a costly operation since it will be done quite seldomly.

        • 1. Re: Flush commit option A's cache
          daeel Newbie

          Is it really that obvious no one care to answer, it can't be too hard could it?

          Anyway I found a solution that work:
          First use JMX and twiddle to make a list of all local EJBs (I.e. in my case all the entities)
          ./twiddle.sh -s localhost:1299 invoke 'jboss:service=JNDIView' listXML | grep local | sort | uniq >flush.sh

          Then edit flush.sh to include a flush command for each entity i.e.:
          ./twiddle.sh -s localhost:1299 invoke 'jboss.j2ee:jndiName=local/[YOUR_FIRST_ENTITY_NAME],plugin=cache,service=EJB' flush
          ./twiddle.sh -s localhost:1299 invoke 'jboss.j2ee:jndiName=local/[YOUR_SECOND_ENTITY_NAME],plugin=cache,service=EJB' flush
          ...and so on

          then you could flush all the entity caches by ./flush.sh

          Of course this could be improved a lot with more clever shell scripting the two commands above could be combined to always flush the deployed entites, then I guess it should be possible to do from Java as well, I'm looking into that now.