Exemplo n.º 1
0
/**
 * <a href="CalEventLocalUtil.java.html"><b><i>View Source</i></b></a>
 *
 * @author Brian Wing Shun Chan
 * @author Michael Young
 */
public class CalEventLocalUtil {

  public static final String CACHE_NAME = CalEventLocalUtil.class.getName();

  protected static void clearEventsPool(long groupId) {
    String key = _encodeKey(groupId);

    _cache.remove(key);
  }

  protected static Map getEventsPool(long groupId) {
    String key = _encodeKey(groupId);

    Map eventsPool = (Map) MultiVMPoolUtil.get(_cache, key);

    if (eventsPool == null) {
      eventsPool = CollectionFactory.getSyncHashMap();

      MultiVMPoolUtil.put(_cache, key, eventsPool);
    }

    return eventsPool;
  }

  private static String _encodeKey(long groupId) {
    StringMaker sm = new StringMaker();

    sm.append(CACHE_NAME);
    sm.append(StringPool.POUND);
    sm.append(groupId);

    return sm.toString();
  }

  private static PortalCache _cache = MultiVMPoolUtil.getCache(CACHE_NAME);
}
  protected void clearFinderCache() {
    PortalCache<String, SocialActivityCounter> portalCache =
        MultiVMPoolUtil.getCache(SocialActivityCounterFinder.class.getName());

    portalCache.removeAll();
  }