I am using a Weblogic 10g clustered environment to deploy my application. In my application, I used the class Cache.javato load some properties from the database lazily. Here's how it works. Cache.javais a singleton class with instance variables as cache objects. For example, one of the instance variables List<String> STORES_IN_CITY. This cache is zero when clusters start. Actual values ββare shown in the database. The implementation of the class is given below:
public class Cache
{
private List<String> STORES_IN_CITY;
private static final Cache cache=new Cache();
public static Cache getCache()
{
return cache;
{
private Cache()
{
}
public List<String> getStoresInCity()
{
if(null==STORES_IN_CITY || STORES_IN_CITY.size()==0){
STORES_IN_CITY=getStoresFromDatabase();
}
return STORES_IN_CITY;
}
}
, STORES_IN_CITY. , , JVM . , , , . . ?
, . - , .
,