Java AtomicInteger getGuid(Object clazz)

Here you can find the source of getGuid(Object clazz)

Description

get Guid

License

Open Source License

Declaration

public static String getGuid(Object clazz) 

Method Source Code


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

import java.util.concurrent.atomic.AtomicInteger;

public class Main {
    final static AtomicInteger seeds = new AtomicInteger();

    public static String getGuid(Object clazz) {
        return getGuid();
    }/*  w w w.ja  v a2  s  . c  o  m*/

    public static String getGuid() {
        long stamp = System.currentTimeMillis();
        long id = seeds.incrementAndGet();

        int current = seeds.get();
        if (current > 1000) {
            seeds.compareAndSet(current, 0);
        }
        return (stamp + "-" + id);

    }
}

Related

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