Hi John!

Simply put a config-file in the root of your classpath (web-inf/classes for 
example) and then write a wrapper (singleton) around the the TreeCache that 
starts the cache.

Code to init the cache. You could call this block from a ContextListener in you 
webbapp.


  | try {
  |  cache = new TreeCache();
  | } catch (Exception e) {
  | throw new Exception("Could not create cache!",e);
  |         }
  |         PropertyConfigurator config = new PropertyConfigurator(); // 
configure tree cache. Needs to be in the classpath
  |         try {
  |             config.configure(cache, "my-treecache-config.xml");
  |         } catch (ConfigureException e) {
  |             throw new Exception("Could not configure cache!",e);
  |         }
  | 
  | try {
  |             cache.startService();
  |         } catch (Exception e) {
  |             throw new Exception("Could not start cache!",e);
  |         }
  | 

Then create whatever put-, get-, remove-methods you need in the wrapper.

The treecache instance will register itself and can be found in your 
jmx-console.

Hope this helps!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965302#3965302

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965302
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to