Github user bostko commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/868#discussion_r38092222
--- Diff:
core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
---
@@ -41,9 +41,15 @@ protected String generateNewIdOfLength(ConfigBag setup,
int len) {
StringShortener shortener = Strings.shortener().separator("-");
shortener.append("system", "brooklyn");
- // randId often not necessary, as an 8-char hex identifier is
added later (in jclouds? can we override?)
- // however it can be useful to have this early in the string, to
prevent collisions in places where it is abbreviated
- shortener.append("randId", Identifiers.makeRandomId(4));
+ /* timeStamp replaces the previously used randId.
+ *
+ * timeStamp uses the standard unix timestamp represented as a
8-char hex string.
+ *
+ * It represents the moment in time when the name is constructed.
+ * It gives the possibility to search easily for instances,
security groups, keypairs, etc
+ * based on timestamp without complicated enumeration
+ */
+ shortener.append("timeStamp",
Long.toString(System.currentTimeMillis() / 1000L, 16));
--- End diff --
You could use Long.toString(1440680387, Character.MAX_RADIX) or even more
explicitly Long.toString(l, 36)
This narrows down the required string length for the timestamp to 6
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---