public static long next() {
    long retVal = sequenceNumber.incrementAndGet();

    if (retVal == Long.MAX_VALUE || retVal < 0) {// retVal <0 is checked for cases where other
                                                 // threads might have incremented sequenceNumber
                                                 // beyond Long.MAX_VALUE

      synchronized (SequenceNumber.class) {
        long currentValue = sequenceNumber.get();
        if (currentValue == Long.MAX_VALUE || retVal < 0) {
          sequenceNumber.set(1);
          retVal = sequenceNumber.get();
        } else {
          retVal = currentValue;
        }
      }
    }
    return retVal;
  }
Sequence number for resource related notifications *
geode-core/src/main/java/org/apache/geode/management/internal/beans/SequenceNumber.java