@Test public void testGetWorkUnitSizeEstimator() { KafkaWorkUnitSizeEstimator estimator = packer.getWorkUnitSizeEstimator(); Assert.assertTrue(estimator instanceof KafkaAvgRecordTimeBasedWorkUnitSizeEstimator); }
KafkaWorkUnitSizeEstimator getWorkUnitSizeEstimator() { if (this.state.contains(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE)) { String sizeEstimatorTypeString = this.state.getProp(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE); Optional<SizeEstimatorType> sizeEstimatorType = Enums.getIfPresent(SizeEstimatorType.class, sizeEstimatorTypeString); if (sizeEstimatorType.isPresent()) { return getWorkUnitSizeEstimator(sizeEstimatorType.get()); } throw new IllegalArgumentException("WorkUnit size estimator type " + sizeEstimatorType + " not found"); } return getWorkUnitSizeEstimator(DEFAULT_SIZE_ESTIMATOR_TYPE); }
KafkaWorkUnitPacker { KafkaWorkUnitSizeEstimator getWorkUnitSizeEstimator() { if (this.state.contains(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE)) { String sizeEstimatorTypeString = this.state.getProp(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE); Optional<SizeEstimatorType> sizeEstimatorType = Enums.getIfPresent(SizeEstimatorType.class, sizeEstimatorTypeString); if (sizeEstimatorType.isPresent()) { return getWorkUnitSizeEstimator(sizeEstimatorType.get()); } throw new IllegalArgumentException("WorkUnit size estimator type " + sizeEstimatorType + " not found"); } return getWorkUnitSizeEstimator(DEFAULT_SIZE_ESTIMATOR_TYPE); } }
KafkaWorkUnitPacker { KafkaWorkUnitSizeEstimator getWorkUnitSizeEstimator() { if (this.state.contains(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE)) { String sizeEstimatorTypeString = this.state.getProp(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE); Optional<SizeEstimatorType> sizeEstimatorType = Enums.getIfPresent(SizeEstimatorType.class, sizeEstimatorTypeString); if (sizeEstimatorType.isPresent()) { return getWorkUnitSizeEstimator(sizeEstimatorType.get()); } throw new IllegalArgumentException("WorkUnit size estimator type " + sizeEstimatorType + " not found"); } return getWorkUnitSizeEstimator(DEFAULT_SIZE_ESTIMATOR_TYPE); } protected  KafkaWorkUnitPacker(AbstractSource<?, ?> source, SourceState state); }
KafkaWorkUnitPacker { KafkaWorkUnitSizeEstimator getWorkUnitSizeEstimator() { if (this.state.contains(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE)) { String sizeEstimatorTypeString = this.state.getProp(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE); Optional<SizeEstimatorType> sizeEstimatorType = Enums.getIfPresent(SizeEstimatorType.class, sizeEstimatorTypeString); if (sizeEstimatorType.isPresent()) { return getWorkUnitSizeEstimator(sizeEstimatorType.get()); } throw new IllegalArgumentException("WorkUnit size estimator type " + sizeEstimatorType + " not found"); } return getWorkUnitSizeEstimator(DEFAULT_SIZE_ESTIMATOR_TYPE); } protected  KafkaWorkUnitPacker(AbstractSource<?, ?> source, SourceState state); static KafkaWorkUnitPacker getInstance(AbstractSource<?, ?> source, SourceState state); static KafkaWorkUnitPacker getInstance(AbstractSource<?, ?> source, SourceState state,
      Optional<MetricContext> metricContext); static KafkaWorkUnitPacker getInstance(PackerType packerType, AbstractSource<?, ?> source, SourceState state, Optional<MetricContext> metricContext); double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic); abstract List<WorkUnit> pack(Map<String, List<WorkUnit>> workUnitsByTopic, int numContainers); }
KafkaWorkUnitPacker { KafkaWorkUnitSizeEstimator getWorkUnitSizeEstimator() { if (this.state.contains(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE)) { String sizeEstimatorTypeString = this.state.getProp(KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE); Optional<SizeEstimatorType> sizeEstimatorType = Enums.getIfPresent(SizeEstimatorType.class, sizeEstimatorTypeString); if (sizeEstimatorType.isPresent()) { return getWorkUnitSizeEstimator(sizeEstimatorType.get()); } throw new IllegalArgumentException("WorkUnit size estimator type " + sizeEstimatorType + " not found"); } return getWorkUnitSizeEstimator(DEFAULT_SIZE_ESTIMATOR_TYPE); } protected  KafkaWorkUnitPacker(AbstractSource<?, ?> source, SourceState state); static KafkaWorkUnitPacker getInstance(AbstractSource<?, ?> source, SourceState state); static KafkaWorkUnitPacker getInstance(AbstractSource<?, ?> source, SourceState state,
      Optional<MetricContext> metricContext); static KafkaWorkUnitPacker getInstance(PackerType packerType, AbstractSource<?, ?> source, SourceState state, Optional<MetricContext> metricContext); double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic); abstract List<WorkUnit> pack(Map<String, List<WorkUnit>> workUnitsByTopic, int numContainers); static final String KAFKA_WORKUNIT_PACKER_TYPE; static final String KAFKA_WORKUNIT_PACKER_CUSTOMIZED_TYPE; static final String KAFKA_WORKUNIT_SIZE_ESTIMATOR_TYPE; static final String KAFKA_WORKUNIT_SIZE_ESTIMATOR_CUSTOMIZED_TYPE; static final String MIN_MULTIWORKUNIT_LOAD; static final String MAX_MULTIWORKUNIT_LOAD; }