@@ -0,0 +1,2158 @@
+/* Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.camunda.bpm.engine.test.concurrency;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.concurrent.ConcurrentSkipListSet;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport com.fasterxml.uuid.EthernetAddress;%0Aimport com.fasterxml.uuid.Generators;%0Aimport com.fasterxml.uuid.impl.TimeBasedGenerator;%0A%0A/**%0A * @author Daniel Meyer%0A *%0A */%0Apublic class UuidGeneratorTest %7B%0A%0A  private static final int THREAD_COUNT = 10;%0A  private static final int LOOP_COUNT = 10000;%0A%0A  @Test%0A  public void testMultithreaded() throws InterruptedException %7B%0A    final List%3CThread%3E threads = new ArrayList%3CThread%3E();%0A%0A    final TimeBasedGenerator timeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());%0A    final ConcurrentSkipListSet%3CString%3E generatedIds = new ConcurrentSkipListSet%3CString%3E();%0A    final ConcurrentSkipListSet%3CString%3E duplicatedIds = new ConcurrentSkipListSet%3CString%3E();%0A%0A    for (int i = 0; i %3C THREAD_COUNT; i++) %7B%0A      Thread thread = new Thread(new Runnable() %7B%0A        @Override%0A        public void run() %7B%0A          for (int j = 0; j %3C LOOP_COUNT; j++) %7B%0A%0A            String id = timeBasedGenerator.generate().toString();%0A            boolean wasAdded = generatedIds.add(id);%0A            if (!wasAdded) %7B%0A              duplicatedIds.add(id);%0A            %7D%0A          %7D%0A        %7D%0A      %7D);%0A      threads.add(thread);%0A      thread.start();%0A    %7D%0A%0A    for (Thread thread : threads) %7B%0A      thread.join();%0A    %7D%0A%0A    Assert.assertEquals(THREAD_COUNT * LOOP_COUNT, generatedIds.size());%0A    Assert.assertTrue(duplicatedIds.isEmpty());%0A  %7D%0A%7D%0A

add UuidGeneratorTest