/** * Will generate unique time based UUID where the next UUID is always * greater then the previous. */ public final static UUID generateId() { return generateId(System.currentTimeMillis()); }
/** * */ public final static UUID generateId(long currentTime) { return generateId(currentTime, randomGenerator.nextLong(), true); }
protected String generateUuid() { final Optional<String> seed = getIdGenerationSeed(); UUID uuid; if (seed.isPresent()) { try { UUID seedId = UUID.fromString(seed.get()); uuid = new UUID(seedId.getMostSignificantBits(), seed.get().hashCode()); } catch (Exception e) { logger.warn("Provided 'seed' does not represent UUID. Will not be able to extract most significant bits for ID generation."); uuid = UUID.nameUUIDFromBytes(seed.get().getBytes(StandardCharsets.UTF_8)); } } else { uuid = ComponentIdGenerator.generateId(); } return uuid.toString(); }
long lsb = randomGenerator.nextLong(); if (isCopy) { uuid = ComponentIdGenerator.generateId(msb, lsb, true); // will increment msb if necessary } else { if (isCopy) { uuid = ComponentIdGenerator.generateId(seedId.getMostSignificantBits(), seedId.getLeastSignificantBits(), false); } else { uuid = new UUID(msb, seedId.getLeastSignificantBits());
final Map<String, String> updatedHeaders = new HashMap<>(headers); updatedHeaders.put(RequestReplicator.CLUSTER_ID_GENERATION_SEED_HEADER, ComponentIdGenerator.generateId().toString()); if (indicateReplicated) { updatedHeaders.put(RequestReplicator.REPLICATION_INDICATOR_HEADER, "true");
this.reloadComponent = new StandardReloadComponent(this); final ProcessGroup rootGroup = new StandardProcessGroup(ComponentIdGenerator.generateId().toString(), controllerServiceProvider, processScheduler, nifiProperties, encryptor, this, new MutableVariableRegistry(this.variableRegistry)); rootGroup.setName(FlowManager.DEFAULT_ROOT_GROUP_NAME); setRootGroup(rootGroup); instanceId = ComponentIdGenerator.generateId().toString();
/** * Will generate unique time based UUID where the next UUID is always * greater then the previous. */ public final static UUID generateId() { return generateId(System.currentTimeMillis()); }
/** * */ public final static UUID generateId(long currentTime) { return generateId(currentTime, randomGenerator.nextLong(), true); }