Java AtomicInteger getId()

Here you can find the source of getId()

Description

get Id

License

Open Source License

Return

a number, starting with 1 and incremented each time. This is guaranteed to be unique _within this run of the jVM_, upto overflow.

Declaration

public static int getId() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.atomic.AtomicInteger;

public class Main {
    private static final AtomicInteger id = new AtomicInteger(1);

    /**/*from w  w w.  j  a v  a  2s . co m*/
     * @return a number, starting with 1 and incremented each time. This is
     *         guaranteed to be unique _within this run of the jVM_, upto
     *         overflow.
     * 
     * @see #getUID()
     */
    public static int getId() {
        return id.getAndIncrement();
    }
}

Related

  1. getCriticalExceptionCount()
  2. getExceptionCountMap()
  3. getFailedMiddlePartNumbers(PartListing partListing)
  4. getGetPendingWrTransaction()
  5. getGuid(Object clazz)
  6. getInstanceCounter(String name)
  7. getLock()
  8. getNextCounter(AtomicInteger counter)
  9. getNextId()