/**
 * JBoss, Home of Professional Open Source.
 * Copyright 2014-2020 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jboss.pnc.common.concurrent;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Sequence {

    private static final Map<Integer, SequenceGenerator> instance = new ConcurrentHashMap<>();
    private static final int INSTANCE_KEY = 0;

    public static Long nextId() {
        SequenceGenerator sequenceGenerator = instance.computeIfAbsent(INSTANCE_KEY, k -> new SequenceGenerator());
        return sequenceGenerator.nextId();
    }
}

@@ -814,16 +814,504 @@
 shMap;%0A%0A
+/**%0A * A class for generating 64-bit unique IDs at high scale. The IDs generated by this service are roughly time sortable.%0A *%0A * The ID generation follows Twitter snowflake pattern and the IDs are made up of the following components:%0A *%0A * Epoch timestamp in millisecond precision - 41 bits (gives us 69 years with a custom epoch) Configured machine id - 10%0A * bits (gives us up to 1024 machines) Sequence number - 12 bits (A local counter per machine that rolls over every%0A * 4096)%0A */%0A
 public c
@@ -1373,25 +1373,16 @@
 Sequence
-Generator
 %3E instan
@@ -1410,16 +1410,23 @@
 shMap%3C%3E(
+1, 1.0f
 );%0A    p
@@ -1476,197 +1476,1069 @@
     
-public static Long nextId() %7B%0A        SequenceGenerator sequenceGenerator = instance.computeIfAbsent(INSTANCE_KEY, k -%3E new SequenceGenerator());%0A        return sequenceGenerator.next
+/**%0A     * If nodeId is used, it can be set only once and have to be set before the first nextId() call. If nodeId is not%0A     * explicitly defined it's calculated based on machines mac address.%0A     *%0A     * @param nodeId an int value between (inclusive) 0 and 1023.%0A     */%0A    public static void setNodeId(int nodeId) %7B%0A        getInstance(nodeId);%0A    %7D%0A%0A    public static Long nextId() %7B%0A        return getInstance(null).sequenceGenerator.nextId();%0A    %7D%0A%0A    private static Sequence getInstance(Integer nodeId) %7B%0A        return instance.computeIfAbsent(INSTANCE_KEY, k -%3E new Sequence(nodeId));%0A    %7D%0A%0A    private SequenceGenerator sequenceGenerator;%0A%0A    private Sequence(Integer nodeId) %7B%0A        if (sequenceGenerator != null && nodeId != null) %7B%0A            throw new IllegalStateException(%22NodeId have to be called only once and before first call to nextId().%22);%0A        %7D%0A        if (nodeId == null) %7B%0A            sequenceGenerator = new SequenceGenerator();%0A        %7D else %7B%0A            sequenceGenerator = new SequenceGenerator(node
 Id
-(
 );%0A
+        %7D%0A
     

Add an option to define nodeId for sequence generator.