Java Utililty Methods AtomicLong

List of utility methods to do AtomicLong

Description

The list of methods to do AtomicLong are organized into topic(s).

Method

longgetNowMicrosUtc()
Return wall clock time, in microseconds since Unix Epoch (1/1/1970 UTC midnight).
long now = System.currentTimeMillis() * 1000;
long time = PREVIOUS_TIME_VALUE.getAndIncrement();
if (now > time) {
    PREVIOUS_TIME_VALUE.compareAndSet(time + 1, now);
    return PREVIOUS_TIME_VALUE.getAndIncrement();
return time;
longgetRAMUniqueID()
a simple counter which is garanteed to be unique ONLY within one instance of a virtual machine.
return ramid.incrementAndGet();
StringgetRandomTopicName()
get Random Topic Name
return "ut_topic_" + System.currentTimeMillis() + "_" + counter.addAndGet(1);
StringgetSequenceNumber()
get Sequence Number
long id = atomicLong.addAndGet(1);
return String.valueOf(id);
StringgetTempDirName()
Return a string which can be used to create a directory in the temporary workspace of whatever is the meaning of the temp space in the present execution environment.
return tmpDirPath + uniqueId.incrementAndGet();
longgetTomorrowTime()
Returns the first millisecond of tomorrow.
final long current = System.currentTimeMillis();
synchronized (TOMORROW) {
    if (current > TOMORROW.get()) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.add(Calendar.DATE, 1);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
...
StringgetTrackedAllocationStatus()
get Tracked Allocation Status
long directByteBufferUsage = DIRECT_BYTE_BUFFER_USAGE.get();
long mmapBufferUsage = MMAP_BUFFER_USAGE.get();
return "direct " + (directByteBufferUsage / BYTES_IN_MEGABYTE) + " MB, mmap "
        + (mmapBufferUsage / BYTES_IN_MEGABYTE) + " MB, total "
        + ((directByteBufferUsage + mmapBufferUsage) / BYTES_IN_MEGABYTE) + " MB";
StringgetUniqueURIString()
Returns a URI unique within a test run.
return "http://example.com/" + Long.toString(uriCounter.incrementAndGet());
voidgreaterAndSet(long value, AtomicLong atomicValue)
greater And Set
synchronized (atomicValue) {
    if (value > atomicValue.get())
        atomicValue.set(value);
booleanisAtomicLong(final N number)
Check if the number is an AtomicLong
return isNumberType(number, AtomicLong.class);