[
https://issues.apache.org/jira/browse/APEXMALHAR-1984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15118318#comment-15118318
]
ASF GitHub Bot commented on APEXMALHAR-1984:
--------------------------------------------
Github user tweise commented on a diff in the pull request:
https://github.com/apache/incubator-apex-malhar/pull/178#discussion_r50922620
--- 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 --
This is not a good enough reason to write inefficient code ;-) How about
having a "KryoCloner" that can be used for multiple objects?
> Operators that use Kryo directly would throw exception in local mode
> --------------------------------------------------------------------
>
> Key: APEXMALHAR-1984
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-1984
> Project: Apache Apex Malhar
> Issue Type: Bug
> Reporter: Siyuan Hua
> Assignee: Siyuan Hua
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)