[ 
https://issues.apache.org/jira/browse/SCB-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315741#comment-16315741
 ] 

ASF GitHub Bot commented on SCB-174:
------------------------------------

seanyinx commented on a change in pull request #105: SCB-174 add kryo serializer
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/105#discussion_r160081707
 
 

 ##########
 File path: 
omega/omega-format/src/main/java/org/apache/servicecomb/saga/omega/format/KryoMessageFormat.java
 ##########
 @@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.saga.omega.format;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.servicecomb.saga.omega.transaction.OmegaException;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.KryoException;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import com.esotericsoftware.kryo.pool.KryoFactory;
+import com.esotericsoftware.kryo.pool.KryoPool;
+
+public class KryoMessageFormat implements MessageFormat {
+
+  private static final int DEFAULT_BUFFER_SIZE = 4096;
+
+  private static final KryoFactory factory = Kryo::new;
+
+  private static final KryoPool pool = new 
KryoPool.Builder(factory).softReferences().build();
+
+  @Override
+  public byte[] serialize(Object[] objects) {
+    Output output = new Output(DEFAULT_BUFFER_SIZE, -1);
 
 Review comment:
   what happens if serialized bytes are larger than default buffer size?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [pack] object serialization/deserialization
> -------------------------------------------
>
>                 Key: SCB-174
>                 URL: https://issues.apache.org/jira/browse/SCB-174
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Saga
>            Reporter: Yin Xiang
>            Assignee: Eric Lee
>             Fix For: saga-0.1.0
>
>
> as of now, we used java native object serializer, i.e. ObjectInputStream & 
> ObjectOutputStream, for quick prototyping. 
> but these serializer/deserializer are problematic and we need to find more 
> suitable one.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to