List of utility methods to do AtomicLong
Date | getDateSafe() Returns a unique Date considering the last stored timestamp. return new Date(getTimestampSafe()); |
long | getForeverUniqueID() PLEASE use only if REALLY needed. Best effort is taken to make it "globally unique" without any persisting media by instantiating it by System.currentTimeMilis * 64, so that after a restart of the vm, the counter advances 64000 units per second which should be enough that that value is never exceeded by the usage of that ID (100 concurrent users which can consume 640 unique id per each second, and: even if exceeded, after a restart of a vm (assumed time at least 10secs), a loss of 10*64000 = 640000 can be caught up if you just need a counter which is unique within the virtual machine, but does not need to be unique if the sessions are persisted and the vm is restarted, then use @see getRAMUniqueID() returns a unique id; even if the system is restarted. return timeuniqueId.incrementAndGet();
|
long | getGlobalTimeStamp() get Global Time Stamp if (globalTimeStamp.get() == 0) { globalTimeStamp.compareAndSet(0, System.currentTimeMillis()); return globalTimeStamp.get(); |
List | getList(AtomicLongArray atomicLongArray) get List if (atomicLongArray == null) { return null; List<Long> counts = new ArrayList<Long>(atomicLongArray.length()); for (int i = 0; i < atomicLongArray.length(); i++) { counts.add(atomicLongArray.get(i)); return counts; ... |
String | getMessageId() get Message Id return String.valueOf(sequence.getAndIncrement());
|
String | getMethodExecuteCount() get Method Execute Count StringBuffer strBuf = new StringBuffer(100); for (int i = 0; i < 24; i++) { strBuf.append("Hour="); strBuf.append(i); strBuf.append(""); strBuf.append(" Count=["); strBuf.append(((AtomicLong) accessCountList[i]).toString()); strBuf.append("], "); ... |
String | getMeUniqueString(Calendar cal) get Me Unique String StringBuilder unq = new StringBuilder(); unq.append(Character.toString((char) ('n' + (cal.get(Calendar.MONTH) % 100)))); unq.append(Character.toString((char) ('@' + (cal.get(Calendar.DAY_OF_MONTH) % 100)))); unq.append(Character.toString((char) ('c' + (cal.get(Calendar.HOUR_OF_DAY) % 100)))); unq.append(getMeChar(cal.get(Calendar.MINUTE) % 100)); unq.append(getMeChar(cal.get(Calendar.SECOND) % 100)); unq.append(getMeChar(idCounter.getAndIncrement())); idCounter.compareAndSet(62, 0); ... |
long | getMmapBufferUsage() Returns the number of bytes of memory mapped files. return MMAP_BUFFER_USAGE.get();
|
long | getNativeSeed(Random rand) get Native Seed AtomicLong al = (AtomicLong) unsafe.getObject(rand, seedFieldOffset);
return al.longValue();
|
String | getNextTestIndexName() get Next Test Index Name return "rdf4j-es-testindex-" + TEST_COUNTER.incrementAndGet(); |