Tabnine Logo
IgniteInternalCache.putIfAbsent
Code IndexAdd Tabnine to your IDE (free)

How to use
putIfAbsent
method
in
org.apache.ignite.internal.processors.cache.IgniteInternalCache

Best Java code snippets using org.apache.ignite.internal.processors.cache.IgniteInternalCache.putIfAbsent (Showing top 9 results out of 315)

origin: apache/ignite

  @Override public Boolean call() throws Exception {
    return cache.putIfAbsent(key, true);
  }
});
origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) {
  IgniteInternalCache<K, V> delegate = getDelegateSafe();
  try {
    if (isAsync()) {
      setFuture(delegate.putIfAbsentAsync(key, val));
      return false;
    }
    else
      return delegate.putIfAbsent(key, val);
  }
  catch (IgniteCheckedException | IgniteException e) {
    throw cacheException(e);
  }
}
origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) {
  try {
    if (isAsync()) {
      setFuture(delegate.putIfAbsentAsync(key, val));
      return false;
    }
    else
      return delegate.putIfAbsent(key, val);
  }
  catch (IgniteCheckedException | IgniteException e) {
    throw cacheException(e);
  }
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean putIfAbsent(Object key, Object val) throws IgniteCheckedException {
  return delegate.get().putIfAbsent(keyTransformer.transform(key), val);
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) throws IgniteCheckedException {
  CacheOperationContext prev = gate.enter(opCtx);
  try {
    return delegate.putIfAbsent(key, val);
  }
  finally {
    gate.leave(prev);
  }
}
origin: apache/ignite

/**
 * Put new entry to meta cache immediately linking it to parent.
 *
 * @param info Info to put.
 * @param parentId Parent ID.
 * @param name Name in parent.
 * @throws IgniteCheckedException If failed.
 */
private void createNewEntry(IgfsEntryInfo info, IgniteUuid parentId, String name) throws IgniteCheckedException {
  validTxState(true);
  if (!id2InfoPrj.putIfAbsent(info.id(), info))
    throw fsException("Failed to create new metadata entry due to ID conflict: " + info.id());
  if (parentId != null)
    id2InfoPrj.invoke(parentId, new IgfsMetaDirectoryListingAddProcessor(name, new IgfsListingEntry(info)));
}
origin: org.apache.ignite/ignite-core

  @Override public Boolean call() throws Exception {
    return cache.putIfAbsent(key, true);
  }
});
origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) throws IgniteCheckedException {
  CacheOperationContext prev = gate.enter(opCtx);
  try {
    return delegate.putIfAbsent(key, val);
  }
  finally {
    gate.leave(prev);
  }
}
origin: org.apache.ignite/ignite-core

/**
 * Put new entry to meta cache immediately linking it to parent.
 *
 * @param info Info to put.
 * @param parentId Parent ID.
 * @param name Name in parent.
 * @throws IgniteCheckedException If failed.
 */
private void createNewEntry(IgfsEntryInfo info, IgniteUuid parentId, String name) throws IgniteCheckedException {
  validTxState(true);
  if (!id2InfoPrj.putIfAbsent(info.id(), info))
    throw fsException("Failed to create new metadata entry due to ID conflict: " + info.id());
  if (parentId != null)
    id2InfoPrj.invoke(parentId, new IgfsMetaDirectoryListingAddProcessor(name, new IgfsListingEntry(info)));
}
org.apache.ignite.internal.processors.cacheIgniteInternalCacheputIfAbsent

Javadoc

Stores given key-value pair in cache only if cache had no previous mapping for it.

This method will return true if value is stored in cache and false otherwise. Unlike #getAndPutIfAbsent(Object,Object) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

If write-through is enabled, the stored value will be persisted to CacheStorevia CacheStore#put(Transaction, Object, Object) method.

Transactions This method is transactional and will enlist the entry into ongoing transaction if there is one.

Popular methods of IgniteInternalCache

  • context
  • get
    Retrieves value mapped to the specified key from cache. Value will only be returned if its entry pas
  • affinity
    Gets affinity service to provide information about data partitioning and distribution.
  • configuration
    Gets configuration bean for this cache.
  • containsKey
  • getAndPut
    Stores given key-value pair in cache. If filters are provided, then entries will be stored in cache
  • getAndPutIfAbsent
    Stores given key-value pair in cache only if cache had no previous mapping for it. If cache previous
  • invoke
  • invokeAsync
  • put
    Stores given key-value pair in cache. If filters are provided, then entries will be stored in cache
  • size
  • cache
    Gets base cache for this projection.
  • size,
  • cache,
  • clear,
  • clearLocallyAll,
  • isEmpty,
  • isIgfsDataCache,
  • keySet,
  • localEntries,
  • localPeek,
  • lock

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now