示例#1
0
  /** {@inheritDoc} */
  public List getKeys() {
    LOG.debug("cache {} getKeys", cache.getName());
    XATransactionContext context = getOrCreateTransactionContext();
    Set<Object> keys =
        new LargeSet<Object>() {

          @Override
          public int sourceSize() {
            return underlyingStore.getSize();
          }

          @Override
          public Iterator<Object> sourceIterator() {
            return underlyingStore.getKeys().iterator();
          }
        };
    keys.addAll(context.getAddedKeys());
    keys.removeAll(context.getRemovedKeys());
    return new SetAsList<Object>(keys);
  }
示例#2
0
 /** {@inheritDoc} */
 public boolean containsKey(Object key) {
   LOG.debug("cache {} containsKey", cache.getName(), key);
   XATransactionContext context = getOrCreateTransactionContext();
   return !context.isRemoved(key)
       && (context.getAddedKeys().contains(key) || underlyingStore.containsKey(key));
 }