test_class.declarator: idRegion
test_class.modifier: private
test_class.original_string: private Region<String, Long> idRegion;
test_class.type: Region<String, Long>
test_class.var_name: idRegion
test_class.declarator: functionServiceHelper
test_class.modifier: private
test_class.original_string: private FunctionServiceHelper functionServiceHelper;
test_class.type: FunctionServiceHelper
test_class.var_name: functionServiceHelper
test_class.file: gemfire-utils/gemfire-keyfw/src/test/java/io/pivotal/bds/gemfire/keyfw/generator/PartitionedRegionIDGeneratorFunctionTest.java
test_class.identifier: PartitionedRegionIDGeneratorFunctionTest
test_case.body: @Test
      void usingFilter() {
          Collection<long[]> coll = (Collection<long[]>) functionServiceHelper
                  .onRegion(idRegion)
                  .withFilter(Collections.singleton("domain"))
                  .execute("PartitionedRegionIDGeneratorFunction")
                  .getResult();
  
          assertEquals(coll.size(), 1);
  
          long[] ids = coll.iterator().next();
          assertEquals(ids.length, 2);
  
          assertEquals(ids[0], 0);
          assertEquals(ids[1],1);
      }
test_case.class_method_signature: PartitionedRegionIDGeneratorFunctionTest.usingFilter()
test_case.full_signature: @Test void usingFilter()
test_case.identifier: usingFilter
test_case.invocations: getResult execute withFilter onRegion singleton assertEquals size next iterator assertEquals assertEquals assertEquals
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void usingFilter()
focal_class.declarator: idRegionName
focal_class.modifier: private
focal_class.original_string: private String idRegionName;
focal_class.type: String
focal_class.var_name: idRegionName
focal_class.declarator: idCount
focal_class.modifier: private
focal_class.original_string: private int idCount;
focal_class.type: int
focal_class.var_name: idCount
focal_class.declarator: idRegion
focal_class.modifier: private
focal_class.original_string: private Region<String, Long> idRegion;
focal_class.type: Region<String, Long>
focal_class.var_name: idRegion
focal_class.declarator: LOG = LoggerFactory.getLogger(PartitionedRegionIDGeneratorFunction.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(PartitionedRegionIDGeneratorFunction.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: gemfire-utils/gemfire-keyfw/src/main/java/io/pivotal/bds/gemfire/keyfw/generator/PartitionedRegionIDGeneratorFunction.java
focal_class.identifier: PartitionedRegionIDGeneratorFunction
focal_class.interfaces: implements Function, Declarable
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.PartitionedRegionIDGeneratorFunction()
focal_class.full_signature: public  PartitionedRegionIDGeneratorFunction()
focal_class.identifier: PartitionedRegionIDGeneratorFunction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  PartitionedRegionIDGeneratorFunction()
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.PartitionedRegionIDGeneratorFunction(String idRegionName, int idCount)
focal_class.full_signature: public  PartitionedRegionIDGeneratorFunction(String idRegionName, int idCount)
focal_class.identifier: PartitionedRegionIDGeneratorFunction
focal_class.modifiers: public
focal_class.parameters: (String idRegionName, int idCount)
focal_class.signature:  PartitionedRegionIDGeneratorFunction(String idRegionName, int idCount)
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.PartitionedRegionIDGeneratorFunction(int idCount, Region<String, Long> idRegion)
focal_class.full_signature: public  PartitionedRegionIDGeneratorFunction(int idCount, Region<String, Long> idRegion)
focal_class.identifier: PartitionedRegionIDGeneratorFunction
focal_class.modifiers: public
focal_class.parameters: (int idCount, Region<String, Long> idRegion)
focal_class.signature:  PartitionedRegionIDGeneratorFunction(int idCount, Region<String, Long> idRegion)
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.execute(FunctionContext functionContext)
focal_class.full_signature: @Override public void execute(FunctionContext functionContext)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (FunctionContext functionContext)
focal_class.return: void
focal_class.signature: void execute(FunctionContext functionContext)
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.getId()
focal_class.full_signature: @Override public String getId()
focal_class.identifier: getId
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getId()
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.hasResult()
focal_class.full_signature: @Override public boolean hasResult()
focal_class.identifier: hasResult
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean hasResult()
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.optimizeForWrite()
focal_class.full_signature: @Override public boolean optimizeForWrite()
focal_class.identifier: optimizeForWrite
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean optimizeForWrite()
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.isHA()
focal_class.full_signature: @Override public boolean isHA()
focal_class.identifier: isHA
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isHA()
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.init(Properties properties)
focal_class.full_signature: @Override public void init(Properties properties)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (Properties properties)
focal_class.return: void
focal_class.signature: void init(Properties properties)
focal_class.class_method_signature: PartitionedRegionIDGeneratorFunction.getRegion()
focal_class.full_signature: private Region<String, Long> getRegion()
focal_class.identifier: getRegion
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Region<String, Long>
focal_class.signature: Region<String, Long> getRegion()
focal_method.body: @Override
      public void execute(FunctionContext functionContext) {
          try {
              String domain = null;
              Object arguments = functionContext.getArguments();
  
              if (arguments != null) {
                  if (arguments.getClass().isArray()) {
                      Object[] args = (Object[]) arguments;
                      assert args.length == 1;
                      domain = args[0].toString();
                  } else {
                      domain = arguments.toString();
                  }
              } else {
                  RegionFunctionContext rctx = (RegionFunctionContext) functionContext;
                  Set<String> filter = (Set<String>) rctx.getFilter();
                  assert filter.size() == 1;
                  domain = filter.iterator().next();
              }
  
              LOG.debug("execute: domain={}", domain);
              Region<String, Long> region = getRegion();
  
              synchronized (PartitionedRegionIDGeneratorFunction.class) {
                  Long firstId = region.computeIfAbsent(domain, t -> -1L) + 1;
                  long lastId = firstId + idCount - 1;
                  LOG.debug("execute: domain={}, firstId={}, lastId={}", domain, firstId, lastId);
                  region.put(domain, lastId);
                  functionContext.getResultSender().lastResult(new long[]{firstId, lastId});
              }
          } catch (Exception x) {
              LOG.error("execute: x={}", x.toString(), x);
              throw new IllegalArgumentException(x.toString(), x);
          }
      }
focal_method.class_method_signature: PartitionedRegionIDGeneratorFunction.execute(FunctionContext functionContext)
focal_method.full_signature: @Override public void execute(FunctionContext functionContext)
focal_method.identifier: execute
focal_method.invocations: getArguments isArray getClass toString toString getFilter size next iterator debug getRegion computeIfAbsent debug put lastResult getResultSender error toString toString
focal_method.modifiers: @Override public
focal_method.parameters: (FunctionContext functionContext)
focal_method.return: void
focal_method.signature: void execute(FunctionContext functionContext)