Code example for AtomicLong

0
 
    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 
        } 
    }