Code example for AtomicInteger

Methods: getAndIncrement, intValue

0
            return 1; 
    } 
 
    public void receiveTiming(InetAddress host, Double latency) // this is cheap
    { 
        if (intervalupdates.intValue() >= UPDATES_PER_INTERVAL)
            return; 
        AdaptiveLatencyTracker tracker = windows.get(host);
        if (tracker == null)
        { 
            AdaptiveLatencyTracker alt = new AdaptiveLatencyTracker(WINDOW_SIZE);
            tracker = windows.putIfAbsent(host, alt);
            if (tracker == null)
                tracker = alt;
        } 
        tracker.add(latency);
        intervalupdates.getAndIncrement();
    } 
 
    private void updateScores() // this is expensive 
    { 
        if (!StorageService.instance.isInitialized())