1 Reply Latest reply on Dec 8, 2004 9:05 AM by dimitris

    startup classes / MBean cache implementation

    p_nevilleuk

      Hi,
      I thought that JBoss had a similar facility to that offered by Sun for automatic startup of classes. For example Sun app server can use a Lifecycle module.

      Is the best way in JBoss to use MBean?

      Are there any other ways (apart from web.xml - servlet/load-on-startup)

      I would like to automatically startup a class that holds a cache of data that changes infrequently. I would like the ability to refresh this cache (perhaps from jmx) and lock access to the cache during update.
      Can MBeans provide locking or would I simply check a state variable that forces a wait whilst refresh takes place?


      Thanks,
      Peter

        • 1. Re: startup classes / MBean cache implementation
          dimitris

          Yes, an MBean would be ideal for that, although there is not automatic locking. If the update you want to do is a quick one, then just using the standard Java "synchronization" facilities, or the oswego library to lock concurrent thread access between readers and the writer would be enough. Otherwise having an update flag, would do.