Java 8 AtomicLong - 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 AtomicLong class.

This code example shows how to use the following methods:get, incrementAndGet, set
        AtomicLong serialId = getSerialId(pid);
 
        // Asign a serialid to the source if we don't already have one 
        String sourceid = source.get(TRANSIENT_PROPERTY_SERIAL_ID);
        if (sourceid == null) {
            sourceid = new Long(serialId.incrementAndGet()).toString();
            source.put(TRANSIENT_PROPERTY_SERIAL_ID, sourceid);
        } 
 
        // Ignore the serialid on rollback 
        if (rollback) {
            LOGGER.debugf("Config rollback: %s => %s", pid, source);
            serialId.set(Long.parseLong(sourceid));
            configurations.put(pid, source);
            return true; 
        } 
 
        // Update if there is no previous config for this pid 
        Dictionary<String, String> previous = configurations.get(pid);
        if (previous == null) {

10
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    private final ByteBufferAllocator allocator;
 
    private final boolean internalAllocator;
 
    final AtomicLong sizeInBytes = new AtomicLong();
 
 
    /** 
     * Constructs a new directory using {@link PlainByteBufferAllocator}. 
     */ 
    public ByteBufferDirectory() { 
        this.allocator = new PlainByteBufferAllocator(false, 1024, 1024 * 10);
        this.internalAllocator = true;
        try { 
            setLockFactory(new SingleInstanceLockFactory()); 
        } catch (IOException e) {
            // will not happen 
        } 
    } 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:get
 
    /** 
     * @return the number of aggregated "used" bytes so far 
     */ 
    public long getUsed() { 
        return this.used.get();
    } 
 
    /** 
     * @return the number of bytes that can be added before the breaker trips 
     */ 
    public long getLimit() { 
        return this.memoryBytesLimit;
    } 
 
    /** 
     * @return the constant multiplier the breaker uses for aggregations 
     */ 
    public double getOverhead() { 
        return this.overheadConstant;
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:incrementAndGet
        logger.info("starting mock repository with random prefix " + randomPrefix);
        mockBlobStore = new MockBlobStore(super.blobStore());
    } 
 
    private void addFailure() { 
        failureCounter.incrementAndGet();
    } 
 
    @Override 
    protected void doStop() throws ElasticSearchException { 
        unblock(); 
        super.doStop(); 
    } 
 
    @Override 
    protected BlobStore blobStore() { 
        return mockBlobStore;
    } 
 
    public boolean blocked() { 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
   */ 
  public ScanMetrics() { 
  } 
 
  private AtomicLong createCounter(String counterName) {
    AtomicLong c = new AtomicLong(0);
    counters.put(counterName, c);
    return c;
  } 
 
  public void setCounter(String counterName, long value) {
    AtomicLong c = this.counters.get(counterName);
    if (c != null) {
      c.set(value);
    } 
  } 
 
  /** 
   * Get all of the values since the last time this function was called. 
   * 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:get
    /** 
     * @return the number of aggregated "used" bytes so far 
     */ 
    @Override 
    public long getUsed() { 
        return this.used.get();
    } 
 
    /** 
     * @return the number of bytes that can be added before the breaker trips 
     */ 
    @Override 
    public long getLimit() { 
        return this.memoryBytesLimit;
    } 
 
    /** 
     * @return the constant multiplier the breaker uses for aggregations 
     */ 
    @Override 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
public class RecoveryStatus extends AbstractRefCounted { 
 
    private final ESLogger logger;
 
    private final static AtomicLong idGenerator = new AtomicLong();
 
    private final String RECOVERY_PREFIX = "recovery.";
 
    private final ShardId shardId;
    private final long recoveryId;
    private final InternalIndexShard indexShard;
    private final RecoveryState state;
    private final DiscoveryNode sourceNode;
    private final String tempFilePrefix;
    private final Store store;
    private final RecoveryTarget.RecoveryListener listener;
 
    private AtomicReference<Thread> waitingRecoveryThread = new AtomicReference<>();
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    private String name;
    private AtomicLong value;
 
    public CounterImpl(String name) {
        this.name = name;
        value = new AtomicLong(0);
        setUpStatsExport(); 
    } 
 
    @Override 
    public synchronized void clear() { 
        value.getAndSet(0);
    } 
 
    @Override 
    public Long get() {
        return value.get();
    } 
 
    private void setUpStatsExport() { 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:incrementAndGet
        super(message, cause);
        setId(); 
    } 
 
    void setId() { 
        long nid = atomicLong.incrementAndGet();
        id = Long.toString(nid, 26);
    } 
 
    public abstract String getErrorTitle();
 
    public abstract String getErrorDescription();
 
    public boolean isSourceAvailable() { 
        return this instanceof SourceAttachment;
    } 
 
    public Integer getLineNumber() {
        return -1; 
    } 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:get
        Assert.assertThat("timeout while waiting for indexing threads to stop", stopLatch.await(6, TimeUnit.MINUTES), equalTo(true));
        assertNoFailures(); 
    } 
 
    public long totalIndexedDocs() { 
        return indexCounter.get();
    } 
 
    public Throwable[] getFailures() {
        return failures.toArray(new Throwable[failures.size()]);
    } 
 
    public void assertNoFailures() { 
        Assert.assertThat(failures, emptyIterable());
    } 
 
    @Override 
    public void close() throws Exception {
        stop(); 
    } 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 AtomicLong Questions & Answers:

See Code Examples for Java 8 AtomicLong Methods: