Github user siyuanh commented on a diff in the pull request:

    
https://github.com/apache/incubator-apex-malhar/pull/178#discussion_r51019702
  
    --- Diff: 
contrib/src/main/java/com/datatorrent/contrib/couchbase/AbstractCouchBaseInputOperator.java
 ---
    @@ -149,15 +145,8 @@ public void partitioned(Map<Integer, 
Partition<AbstractCouchBaseInputOperator<T>
         int numPartitions = conf.getServers().size();
         List<String> list = conf.getServers();
         Collection<Partition<AbstractCouchBaseInputOperator<T>>> newPartitions 
= Lists.newArrayListWithExpectedSize(numPartitions);
    -    Kryo kryo = new Kryo();
         for (int i = 0; i < numPartitions; i++) {
    -      ByteArrayOutputStream bos = new ByteArrayOutputStream();
    -      Output output = new Output(bos);
    -      kryo.writeObject(output, this);
    -      output.close();
    -      Input lInput = new Input(bos.toByteArray());
    -      @SuppressWarnings("unchecked")
    -      AbstractCouchBaseInputOperator<T> oper = kryo.readObject(lInput, 
this.getClass());
    +      AbstractCouchBaseInputOperator<T> oper = 
PartitionerUtils.cloneOperatorByKryo(this);
    --- End diff --
    
    I've created a threadlocal pool for kryo objects. I think it's even better 
idea to create kryo on the fly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to