Package com.j_spaces.map

Examples of com.j_spaces.map.IMap


  }

  private Object getCacheElement(int keyAndModelIndex) throws Exception {
    KeyAndModel keyAndModel = getKeyAndModel(keyAndModelIndex);
    GigaSpacesCachingModel model = (GigaSpacesCachingModel) keyAndModel.model;
    IMap cache = (IMap) CacheFinder.find(model.getCacheName());
    return cache.get(keyAndModel.key);
  }
View Full Code Here


   * @throws CacheNotFoundException if the cache does not exist
   * @throws CacheAccessException   wrapping any unexpected exception thrown by the cache
   */
  protected IMap getCache(String name) throws CacheNotFoundException,
      CacheAccessException {
    IMap cache = (IMap) cachesHolder.get(name);
    try {
      if (cache == null) {
        cache = (IMap) CacheFinder.find(name);
        cachesHolder.put(name, cache);
      }
View Full Code Here

      CacheException cacheException = null;
      int nameCount = cacheNames.length;

      try {
        for (int i = 0; i < nameCount; i++) {
          IMap cache = getCache(cacheNames[i]);
          cache.clear();
        }
      } catch (CacheException exception) {
        cacheException = exception;
      } catch (Exception exception) {
        cacheException = new CacheAccessException(exception);
View Full Code Here

   * @throws CacheAccessException   wrapping any unexpected exception thrown by the cache.
   * @see AbstractCacheProviderFacade#onGetFromCache(Serializable,CachingModel)
   */
  protected Object onGetFromCache(Serializable key, CachingModel model)
      throws CacheException {
    IMap cache = getCache(model);
    GigaSpacesCachingModel gigaSpacesCachingModel = (GigaSpacesCachingModel) model;
    Object cachedObject;

    try {
      Long waitForResponse = gigaSpacesCachingModel.getWaitForResponse();
      if (waitForResponse != null) {
        cachedObject = cache.get(key, waitForResponse.longValue());
      } else {
        cachedObject = cache.get(key);
      }
    } catch (Exception exception) {
      throw new CacheAccessException(exception);
    }
    return cachedObject;
View Full Code Here

   */
  protected void onPutInCache(Serializable key, CachingModel model, Object obj)
      throws CacheException {
    try {
      GigaSpacesCachingModel gigaSpacesCachingModel = (GigaSpacesCachingModel) model;
      IMap cache = getCache(gigaSpacesCachingModel);
      Long timeToLive = gigaSpacesCachingModel.getTimeToLive();
      if (timeToLive != null) {
        cache.put(key, obj, timeToLive.longValue());
      } else {
        cache.put(key, obj);
      }
    } catch (Exception exception) {
      throw new CacheAccessException(exception);
    }
  }
View Full Code Here

   * @see AbstractCacheProviderFacade#onRemoveFromCache(Serializable,
   *CachingModel)
   */
  protected void onRemoveFromCache(Serializable key, CachingModel model)
      throws CacheException {
    IMap cache = getCache(model);
    try {
      cache.remove(key);

    } catch (Exception exception) {
      throw new CacheAccessException(exception);
    }
  }
View Full Code Here

TOP

Related Classes of com.j_spaces.map.IMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.