This is an automated email from the ASF dual-hosted git repository. sijie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new b50e0eb improve data-generator source performance (#4058) b50e0eb is described below commit b50e0eba8387ca0a3c5b7f7cd05f20e48c6c6f45 Author: Boyang Jerry Peng <jerry.boyang.p...@gmail.com> AuthorDate: Wed Apr 17 22:31:54 2019 -0700 improve data-generator source performance (#4058) ### Motivation Only initialize factory once in the beginning --- .../org/apache/pulsar/io/datagenerator/DataGeneratorSource.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pulsar-io/data-generator/src/main/java/org/apache/pulsar/io/datagenerator/DataGeneratorSource.java b/pulsar-io/data-generator/src/main/java/org/apache/pulsar/io/datagenerator/DataGeneratorSource.java index 1a9f63f..118025a 100644 --- a/pulsar-io/data-generator/src/main/java/org/apache/pulsar/io/datagenerator/DataGeneratorSource.java +++ b/pulsar-io/data-generator/src/main/java/org/apache/pulsar/io/datagenerator/DataGeneratorSource.java @@ -29,9 +29,11 @@ import java.util.Optional; public class DataGeneratorSource implements Source<Person> { + private Fairy fairy; + @Override public void open(Map<String, Object> config, SourceContext sourceContext) throws Exception { - + this.fairy = Fairy.create(); } @Override @@ -45,7 +47,7 @@ public class DataGeneratorSource implements Source<Person> { @Override public Person getValue() { - return new Person(Fairy.create().person()); + return new Person(fairy.person()); } }; }