diff --git a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java index b5ddc184..f632b698 100644 --- a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java +++ b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java @@ -55,14 +55,14 @@ private UniqueIdGenerator() private static long previousTimeMilliseconds = 0; private static long previousTimeMilliseconds2 = 0; private static final int serverId; - private static final Map lastIds = new LinkedHashMap() + private static final Map lastIds = new LinkedHashMap<>() { protected boolean removeEldestEntry(Map.Entry eldest) { return size() > 1000; } }; - private static final Map lastIdsFull = new LinkedHashMap() + private static final Map lastIdsFull = new LinkedHashMap<>() { protected boolean removeEldestEntry(Map.Entry eldest) { @@ -113,7 +113,7 @@ private static int getServerId(String externalVarName) } catch (NumberFormatException e) { - System.out.println("Unable to get unique server id or index from environment variable/system property key-value: " + externalVarName + "=" + id); + System.err.println("Unable to get unique server id or index from environment variable/system property key-value: " + externalVarName + "=" + id); e.printStackTrace(System.err); return -1; } @@ -130,7 +130,7 @@ private static int getServerId(String externalVarName) * be highly unlikely because for a collision to occur, a number would have to be chosen at the same millisecond * with the count at the same position.
*
- * This API is slower than the 19 digit API. Grabbing a bunch of IDs in a tight loop for example, could causes + * This API is slower than the 19 digit API. Grabbing a bunch of IDs in a tight loop for example, could cause * delays while it waits for the millisecond to tick over. This API can return 1,000 unique IDs per millisecond * max.
*
@@ -227,7 +227,7 @@ private static long getFullUniqueId19() /** * Find out when the ID was generated. * - * @param uniqueId long unique ID that was generated from the the .getUniqueId() API + * @param uniqueId long unique ID that was generated from the .getUniqueId() API * @return Date when the ID was generated, with the time portion accurate to the millisecond. The time * is measured in milliseconds, between the time the id was generated and midnight, January 1, 1970 UTC. */ @@ -239,7 +239,7 @@ public static Date getDate(long uniqueId) /** * Find out when the ID was generated. "19" version. * - * @param uniqueId long unique ID that was generated from the the .getUniqueId19() API + * @param uniqueId long unique ID that was generated from the .getUniqueId19() API * @return Date when the ID was generated, with the time portion accurate to the millisecond. The time * is measured in milliseconds, between the time the id was generated and midnight, January 1, 1970 UTC. */