test_class.file: dropwizard-service-discovery-bundle/src/test/java/io/appform/dropwizard/discovery/bundle/id/IdGeneratorTest.java
test_class.identifier: IdGeneratorTest
test_case.body: @Test
      public void testGenerateWithConstraintsNoConstraint() throws Exception {
          IdGenerator.initialize(23);
          int numRunners = 20;
  
          ImmutableList.Builder<ConstraintRunner> listBuilder = ImmutableList.builder();
          for (int i = 0; i < numRunners; i++) {
              listBuilder.add(new ConstraintRunner(new PartitionValidator(4, new JavaHashCodeBasedKeyPartitioner(16))));
          }
  
          List<ConstraintRunner> runners = listBuilder.build();
          ExecutorService executorService = Executors.newFixedThreadPool(numRunners);
          for(ConstraintRunner runner : runners) {
              executorService.submit(runner);
          }
          Thread.sleep(10000);
          executorService.shutdownNow();
  
          long totalCount = runners.stream().mapToLong(ConstraintRunner::getCount).sum();
  
          log.debug("Generated ID count: {}", totalCount);
          log.debug("Generated ID rate: {}/sec", totalCount/10);
          Assert.assertTrue(totalCount > 0);
  
      }
test_case.class_method_signature: IdGeneratorTest.testGenerateWithConstraintsNoConstraint()
test_case.full_signature: @Test public void testGenerateWithConstraintsNoConstraint()
test_case.identifier: testGenerateWithConstraintsNoConstraint
test_case.invocations: initialize builder add build newFixedThreadPool submit sleep shutdownNow sum mapToLong stream debug debug assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateWithConstraintsNoConstraint()
focal_class.declarator: random = new SecureRandom(Long.toBinaryString(System.currentTimeMillis()).getBytes())
focal_class.modifier: private static
focal_class.original_string: private static SecureRandom random = new SecureRandom(Long.toBinaryString(System.currentTimeMillis()).getBytes());
focal_class.type: SecureRandom
focal_class.var_name: random
focal_class.declarator: nodeId
focal_class.modifier: private static
focal_class.original_string: private static int nodeId;
focal_class.type: int
focal_class.var_name: nodeId
focal_class.declarator: formatter = DateTimeFormat.forPattern("yyMMddHHmmssSSS")
focal_class.modifier: private static
focal_class.original_string: private static DateTimeFormatter formatter = DateTimeFormat.forPattern("yyMMddHHmmssSSS");
focal_class.type: DateTimeFormatter
focal_class.var_name: formatter
focal_class.declarator: collisionChecker = new CollisionChecker()
focal_class.modifier: private static final
focal_class.original_string: private static final CollisionChecker collisionChecker = new CollisionChecker();
focal_class.type: CollisionChecker
focal_class.var_name: collisionChecker
focal_class.declarator: globalConstraints = Collections.emptyList()
focal_class.modifier: private static
focal_class.original_string: private static List<IdValidationConstraint> globalConstraints = Collections.emptyList();
focal_class.type: List<IdValidationConstraint>
focal_class.var_name: globalConstraints
focal_class.declarator: domainSpecificConstraints = new HashMap<>()
focal_class.modifier: private static
focal_class.original_string: private static Map<String, List<IdValidationConstraint>> domainSpecificConstraints = new HashMap<>();
focal_class.type: Map<String, List<IdValidationConstraint>>
focal_class.var_name: domainSpecificConstraints
focal_class.declarator: retrier = RetryerBuilder.<GenerationResult>newBuilder()
              .withStopStrategy(StopStrategies.stopAfterAttempt(512))
              .retryIfException()
              .retryIfResult(Objects::isNull)
              .retryIfResult(result -> result.getState().equals(IdValidationState.INVALID_RETRYABLE))
              .build()
focal_class.modifier: private static final
focal_class.original_string: private static final Retryer<GenerationResult> retrier = RetryerBuilder.<GenerationResult>newBuilder()
              .withStopStrategy(StopStrategies.stopAfterAttempt(512))
              .retryIfException()
              .retryIfResult(Objects::isNull)
              .retryIfResult(result -> result.getState().equals(IdValidationState.INVALID_RETRYABLE))
              .build();
focal_class.type: Retryer<GenerationResult>
focal_class.var_name: retrier
focal_class.file: dropwizard-service-discovery-bundle/src/main/java/io/appform/dropwizard/discovery/bundle/id/IdGenerator.java
focal_class.identifier: IdGenerator
focal_class.class_method_signature: IdGenerator.initialize(int node)
focal_class.full_signature: public static void initialize(int node)
focal_class.identifier: initialize
focal_class.modifiers: public static
focal_class.parameters: (int node)
focal_class.return: void
focal_class.signature: void initialize(int node)
focal_class.class_method_signature: IdGenerator.cleanUp()
focal_class.full_signature: public static void cleanUp()
focal_class.identifier: cleanUp
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void cleanUp()
focal_class.class_method_signature: IdGenerator.initialize(
              int node, List<IdValidationConstraint> globalConstraints, Map<String, List<IdValidationConstraint>> domainSpecificConstraints)
focal_class.full_signature: public static void initialize(
              int node, List<IdValidationConstraint> globalConstraints, Map<String, List<IdValidationConstraint>> domainSpecificConstraints)
focal_class.identifier: initialize
focal_class.modifiers: public static
focal_class.parameters: (
              int node, List<IdValidationConstraint> globalConstraints, Map<String, List<IdValidationConstraint>> domainSpecificConstraints)
focal_class.return: void
focal_class.signature: void initialize(
              int node, List<IdValidationConstraint> globalConstraints, Map<String, List<IdValidationConstraint>> domainSpecificConstraints)
focal_class.class_method_signature: IdGenerator.registerGlobalConstraints(IdValidationConstraint... constraints)
focal_class.full_signature: public static synchronized void registerGlobalConstraints(IdValidationConstraint... constraints)
focal_class.identifier: registerGlobalConstraints
focal_class.modifiers: public static synchronized
focal_class.parameters: (IdValidationConstraint... constraints)
focal_class.return: void
focal_class.signature: void registerGlobalConstraints(IdValidationConstraint... constraints)
focal_class.class_method_signature: IdGenerator.registerGlobalConstraints(List<IdValidationConstraint> constraints)
focal_class.full_signature: public static synchronized void registerGlobalConstraints(List<IdValidationConstraint> constraints)
focal_class.identifier: registerGlobalConstraints
focal_class.modifiers: public static synchronized
focal_class.parameters: (List<IdValidationConstraint> constraints)
focal_class.return: void
focal_class.signature: void registerGlobalConstraints(List<IdValidationConstraint> constraints)
focal_class.class_method_signature: IdGenerator.registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints)
focal_class.full_signature: public static synchronized void registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints)
focal_class.identifier: registerDomainSpecificConstraints
focal_class.modifiers: public static synchronized
focal_class.parameters: (String domain, IdValidationConstraint... validationConstraints)
focal_class.return: void
focal_class.signature: void registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints)
focal_class.class_method_signature: IdGenerator.registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints)
focal_class.full_signature: public static synchronized void registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints)
focal_class.identifier: registerDomainSpecificConstraints
focal_class.modifiers: public static synchronized
focal_class.parameters: (String domain, List<IdValidationConstraint> validationConstraints)
focal_class.return: void
focal_class.signature: void registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints)
focal_class.class_method_signature: IdGenerator.generate(String prefix)
focal_class.full_signature: public static Id generate(String prefix)
focal_class.identifier: generate
focal_class.modifiers: public static
focal_class.parameters: (String prefix)
focal_class.return: Id
focal_class.signature: Id generate(String prefix)
focal_class.class_method_signature: IdGenerator.generateWithConstraints(String prefix, String domain)
focal_class.full_signature: public static Optional<Id> generateWithConstraints(String prefix, String domain)
focal_class.identifier: generateWithConstraints
focal_class.modifiers: public static
focal_class.parameters: (String prefix, String domain)
focal_class.return: Optional<Id>
focal_class.signature: Optional<Id> generateWithConstraints(String prefix, String domain)
focal_class.class_method_signature: IdGenerator.generateWithConstraints(String prefix, String domain, boolean skipGlobal)
focal_class.full_signature: public static Optional<Id> generateWithConstraints(String prefix, String domain, boolean skipGlobal)
focal_class.identifier: generateWithConstraints
focal_class.modifiers: public static
focal_class.parameters: (String prefix, String domain, boolean skipGlobal)
focal_class.return: Optional<Id>
focal_class.signature: Optional<Id> generateWithConstraints(String prefix, String domain, boolean skipGlobal)
focal_class.class_method_signature: IdGenerator.generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints)
focal_class.full_signature: public static Optional<Id> generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints)
focal_class.identifier: generateWithConstraints
focal_class.modifiers: public static
focal_class.parameters: (String prefix, final List<IdValidationConstraint> inConstraints)
focal_class.return: Optional<Id>
focal_class.signature: Optional<Id> generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints)
focal_class.class_method_signature: IdGenerator.generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints, boolean skipGlobal)
focal_class.full_signature: public static Optional<Id> generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints, boolean skipGlobal)
focal_class.identifier: generateWithConstraints
focal_class.modifiers: public static
focal_class.parameters: (String prefix, final List<IdValidationConstraint> inConstraints, boolean skipGlobal)
focal_class.return: Optional<Id>
focal_class.signature: Optional<Id> generateWithConstraints(String prefix, final List<IdValidationConstraint> inConstraints, boolean skipGlobal)
focal_class.class_method_signature: IdGenerator.random()
focal_class.full_signature: private static synchronized IdInfo random()
focal_class.identifier: random
focal_class.modifiers: private static synchronized
focal_class.parameters: ()
focal_class.return: IdInfo
focal_class.signature: IdInfo random()
focal_class.class_method_signature: IdGenerator.validateId(List<IdValidationConstraint> inConstraints, Id id, boolean skipGlobal)
focal_class.full_signature: private static IdValidationState validateId(List<IdValidationConstraint> inConstraints, Id id, boolean skipGlobal)
focal_class.identifier: validateId
focal_class.modifiers: private static
focal_class.parameters: (List<IdValidationConstraint> inConstraints, Id id, boolean skipGlobal)
focal_class.return: IdValidationState
focal_class.signature: IdValidationState validateId(List<IdValidationConstraint> inConstraints, Id id, boolean skipGlobal)
focal_method.body: public static void initialize(int node) {
          nodeId = node;
      }
focal_method.class_method_signature: IdGenerator.initialize(int node)
focal_method.full_signature: public static void initialize(int node)
focal_method.identifier: initialize
focal_method.modifiers: public static
focal_method.parameters: (int node)
focal_method.return: void
focal_method.signature: void initialize(int node)