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
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 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 
        } 
    } 
Full Snippet Info
9
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
 
    /** 
     * @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;
Full Snippet Info
9
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: 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() { 
Full Snippet Info
9
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:
   */ 
  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. 
   * 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 AtomicLong Questions & Answers:

See Code Examples for Java 8 AtomicLong Methods: