Java 8 AtomicReference - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AtomicReference class.

This code example shows how to use the following methods: get
package org.infinispan.api.batch; 
 
import org.infinispan.Cache; 
import org.infinispan.test.AbstractInfinispanTest; 
 
import java.util.concurrent.atomic.AtomicReference;
 
public abstract class AbstractBatchTest extends AbstractInfinispanTest { 
   protected String getOnDifferentThread(final Cache<String, String> cache, final String key) throws InterruptedException {
      final AtomicReference<String> ref = new AtomicReference<String>();
      Thread t = new Thread() {
         public void run() { 
            cache.startBatch(); 
            ref.set(cache.get(key));
            cache.endBatch(true); 
         } 
      }; 
 
      t.start();
      t.join();

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    private final DiscoveryNode sourceNode;
    private final String tempFilePrefix;
    private final Store store;
    private final RecoveryTarget.RecoveryListener listener;
 
    private AtomicReference<Thread> waitingRecoveryThread = new AtomicReference<>();
 
    private final AtomicBoolean finished = new AtomicBoolean();
 
    private final ConcurrentMap<String, IndexOutput> openIndexOutputs = ConcurrentCollections.newConcurrentMap();
    private final Store.LegacyChecksums legacyChecksums = new Store.LegacyChecksums();
 
    public RecoveryStatus(InternalIndexShard indexShard, DiscoveryNode sourceNode, RecoveryState state, RecoveryTarget.RecoveryListener listener) {
        super("recovery_status"); 
        this.recoveryId = idGenerator.incrementAndGet();
        this.listener = listener;
        this.logger = Loggers.getLogger(getClass(), indexShard.indexSettings(), indexShard.shardId());
        this.indexShard = indexShard;
        this.sourceNode = sourceNode;
        this.shardId = indexShard.shardId();
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: get
This code example shows how to use the following methods: compareAndSet, get
    } 
 
    @Override 
    public L getLocalContext() { 
        if (this.localContextFactory == null) return null;
        L localContext = this.localContext.get();
        if (localContext == null) {
            localContext = this.localContextFactory.createLocalContext();
            if (!this.localContext.compareAndSet(null, localContext)) {
                return this.localContext.get();
            } 
        } 
        return localContext;
    } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: get
     * As a result we wait and add the Canvas prior to attempting to create the Player but  
     * only for MFPlayer. 
     */ 
    private Player createWindows7MFPlayer(File file, final Container parentComponent) throws IncompatibleSourceException {
         //DS failed.  Now we try MF. 
         final AtomicReference<Canvas> mfCanvas = new AtomicReference<Canvas>();  
         try { 
             //create new canvas and add to parentComponent so we can get an hwnd 
             SwingUtilities.invokeAndWait(new Runnable() { 
                 @Override 
                 public void run() { 
                     Canvas canvas = new Canvas(); 
                     parentComponent.add(canvas); 
                     //addNotify to make sure we have a working hwnd 
                     parentComponent.addNotify(); 
                     mfCanvas.set(canvas); 
                 } 
             }); 
         } catch (InterruptedException e) { 
             throw new IncompatibleSourceException(e.toString() + " \n" + ExceptionUtils.getStackTrace(e)); 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 AtomicReference Methods: