Hi
How can I develop a small cache without losing hot deployment functionality of JBOSS ? Ans
suggestion will be appreciated.
I'm planing to write code similar to following but it will not assure hot deployment
will work properly.... (Example is written by me.. And I know it can written better :) )
import java.lang.ref.SoftReference;
import java.util.concurrent.ConcurrentHashMap;
abstract class BaseClass {
public abstract String test();
}
class AClass extends BaseClass{
public String test(){
return "A";
}
}
class BClass extends BaseClass {
public String test(){
return "B";
}
}
public class SmallCache{
private static ConcurrentHashMap<Integer,SoftReference> testMap = new
ConcurrentHashMap<Integer, SoftReference>();
public static BaseClass getInstance(int type){
SoftReference sf = testMap.get(type);
if(sf == null)
{
switch(type)
{
case 1: testMap.put(type, new SoftReference(new AClass()));
break;
case 2: testMap.put(type, new SoftReference(new BClass()));
break;
default:
System.out.println("Ignore it for now");
}
}
return sf.get();
}
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108992#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...