public void publish(String key, String value) { logger.log(Level.INFO, "adding cache entry: " + key + " = " + value); try { if (cache == null) { cache = gms.getGroupHandle().getDistributedStateCache(); } cache.addToCache(GROUP_NAME, gms.getInstanceName(), key, value); GroupHandle gh = gms.getGroupHandle(); gh.sendMessage(CACHE_CHANGE, CACHE_CHANGE.getBytes()); } catch (GMSException e) { logger.log(Level.SEVERE, "Error updating cache" + e); } }
public Map getCache() { if (cache == null) { cache = gms.getGroupHandle().getDistributedStateCache(); } return cache.getAllCache(); }