5 Replies Latest reply on Jan 29, 2007 1:05 PM by Manik Surtani

    Clearing cache contents in JBoss using GUI

    suman291857 Newbie

      Hello,
      Can anyone advise me how to clear cache using JMX Mbeans.This is the xml file which iam loading

      <?xml version="1.0" encoding="UTF-8" ?>
      <server>
       <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
      
       <!-- ==================================================================== -->
       <!-- Defines TreeCache configuration -->
       <!-- ==================================================================== -->
       <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=CustomTreeCache">
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
      
      
       <!-- Configure the TransactionManager -->
       <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
      
       <!--
       Node locking level : SERIALIZABLE
       REPEATABLE_READ (default)
       READ_COMMITTED
       READ_UNCOMMITTED
       NONE
       -->
       <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
      
       <!-- Valid modes are LOCAL
       REPL_ASYNC
       REPL_SYNC
       -->
       <attribute name="CacheMode">LOCAL</attribute>
      
      
       <!-- The max amount of time (in milliseconds) we wait until the
       initial state (ie. the contents of the cache) are retrieved from
       existing members in a clustered environment
       -->
       <attribute name="InitialStateRetrievalTimeout">5000</attribute>
      
      
      
       <!-- Number of milliseconds to wait until all responses for a
       synchronous call have been received.
       -->
       <attribute name="SyncReplTimeout">10000</attribute>
      
       <!-- Max number of milliseconds to wait for a lock acquisition -->
       <attribute name="LockAcquisitionTimeout">15000</attribute>
      
      
      
       </mbean>
       <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">
       <depends>jboss.cache:service=CustomTreeCache</depends>
       <attribute name="CacheService">jboss.cache:service=CustomTreeCache</attribute>
       </mbean>
      </server>
      


      And i have TreeCacheGUI from the JMX console.Even on deleting the Node from TreeCacheGUI ,my code still seems to pick up the old cache contents.
      Hers the code snippet
      
      ClassPathXmlApplicationContext context = ApplicationContextSingleton.getSpringApplicationContext();
       TreeCacheMBean cacheObj = (TreeCacheMBean)context.getBean(CACHE_SPRING_BEAN_NAME);
      (List<Offer>)cacheObj.get(path, key);
      


      Can anyone kindly advise?

      Many Thanks
      Prashanth