Example #1
0
  /** {@inheritDoc} */
  public Element removeWithWriter(Object key, CacheWriterManager writerManager)
      throws CacheException {
    LOG.debug("cache {} removeWithWriter {}", cache.getName(), key);
    // this forces enlistment so the XA transaction timeout can be propagated to the XA resource
    getOrCreateTransactionContext();

    Element oldElement = getQuietFromUnderlyingStore(key);
    if (writerManager != null) {
      writerManager.remove(new CacheEntry(key, null));
    } else {
      cache.getWriterManager().remove(new CacheEntry(key, null));
    }
    return removeInternal(new StoreRemoveCommand(key, oldElement));
  }
Example #2
0
  /** {@inheritDoc} */
  public boolean putWithWriter(Element element, CacheWriterManager writerManager)
      throws CacheException {
    LOG.debug("cache {} putWithWriter {}", cache.getName(), element);
    // this forces enlistment so the XA transaction timeout can be propagated to the XA resource
    getOrCreateTransactionContext();

    Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey());
    if (writerManager != null) {
      writerManager.put(element);
    } else {
      cache.getWriterManager().put(element);
    }
    return internalPut(new StorePutCommand(oldElement, copyElementForWrite(element)));
  }