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

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

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

origin: apache/ignite

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

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

  @Override public void run() {
    while (run) {
      TreeMap<Integer, String> vals = generateValues(keys);
      try {
        // Explicit lock.
        cache.lock(vals.firstKey(), 0);
        try {
          // Put or remove.
          if (ThreadLocalRandom.current().nextDouble(1) < 0.65)
            cache.putAll(vals);
          else
            cache.removeAll(vals.keySet());
        }
        catch (IgniteCheckedException e) {
          U.error(log(), "Failed cache operation.", e);
        }
        finally {
          cache.unlock(vals.firstKey());
        }
        U.sleep(100);
      }
      catch (Throwable e){
        U.error(log(), "Failed unlock.", e);
        err = e;
        return;
      }
    }
  }
};
origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public boolean lock(K key, long timeout)
  throws IgniteCheckedException {
  CacheOperationContext prev = gate.enter(opCtx);
  try {
    return delegate.lock(key, timeout);
  }
  finally {
    gate.leave(prev);
  }
}
org.apache.ignite.internal.processors.cacheIgniteInternalCachelock

Javadoc

Synchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation. Transactions Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency#PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

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

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • findViewById (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Sublime Text plugins
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