Code example for AtomicInteger

Methods: decrementAndGet

0
    public void addSlowLoadingIgnoreUrl(String url) { 
        slowLoadingIgnoreUrls.add(url); 
    } 
 
    public void registerKilledThread() { 
        numberOfRunningThreads.decrementAndGet(); 
    } 
 
    public void registerNewThread() { 
        numberOfRunningThreads.incrementAndGet(); 
    } 
 
    public boolean allowedToCreateNewThread() { 
        if (numberOfRunningThreads.get() <= maxAllowedRunningThreads) { 
            return true; 
        } 
        return false; 
    } 
}