[jboss-user] [JBossCache] - Re: jbosscache 1.4.1.sp5 running on oc4j 10.1.3

zinformagm do-not-reply at jboss.com
Tue Oct 23 19:09:12 EDT 2007


BTW, I am also using log4j.

this is the coding:

package com.igm.gml.cache;

import java.net.InetAddress;

import javax.servlet.ServletContext;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

import org.jboss.cache.TreeCache;
import org.jboss.cache.lock.IsolationLevel;


public class JbCacheUtil {
    static Logger logger = Logger.getLogger(JbCacheUtil.class);
    static TreeCache tc = null;
    static ServletContext context = null;
    static {
    BasicConfigurator.configure();
    logger.info("TreeCache is initializing....");
    try {
        tc = new TreeCache();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String hostName = InetAddress.getLocalHost().getHostName();
        System.out.println("host ip = " + ip);
        System.out.println("host name = " + hostName);
        org.jboss.cache.PropertyConfigurator config=new org.jboss.cache.PropertyConfigurator();
        try {
          config.configure(tc, "cache-service.xml"); // read in generic replSync xml
          System.out.println("cache configurator loaded cache-service.xml");
        } catch (Exception configException1) {
            configException1.printStackTrace();
        }
        System.out.println("CacheMode = " + tc.getCacheMode());
        tc.setIsolationLevel(IsolationLevel.SERIALIZABLE);
        tc.setLockAcquisitionTimeout(5000);
        tc.startService();
        System.out.println("TreeCache finished initializing.");
      } catch (Exception e) {
        logger.error(e, e);
      }
    }
    
    public static TreeCache getTreeCache() {
      return tc;
    }
    
    public static void setTreeCache(TreeCache treeCache) {
      tc =  treeCache;
    }
    
    public static void setContext(ServletContext p_context) {
      context = p_context;
    }
    
    public static ServletContext getContext() {
      return context;
    }
}

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098085



More information about the jboss-user mailing list