From 77dbfbed73a5a5fdd69b53bc5b70c8d23bf6750d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E9=87=91=E5=87=AF?= Date: Tue, 8 Jan 2019 10:54:51 +0800 Subject: [PATCH] Add javadoc for dubbo-serialization module(#3002). (#3004) Add javadoc for dubbo-serialization module(#3002). --- .../dubbo/common/serialize/Cleanable.java | 6 +++++ .../dubbo/common/serialize/DataInput.java | 2 +- .../dubbo/common/serialize/DataOutput.java | 8 +++--- .../dubbo/common/serialize/ObjectInput.java | 25 ++++++++++++------- .../dubbo/common/serialize/ObjectOutput.java | 2 +- .../dubbo/common/serialize/Serialization.java | 23 ++++++++++------- .../support/SerializableClassRegistry.java | 14 +++++++++++ .../support/SerializationOptimizer.java | 8 ++++-- .../fastjson/FastJsonObjectInput.java | 3 +++ .../fastjson/FastJsonObjectOutput.java | 3 +++ .../fastjson/FastJsonSerialization.java | 7 ++++++ .../common/serialize/fst/FstFactory.java | 3 +++ .../common/serialize/fst/FstObjectInput.java | 4 ++- .../common/serialize/fst/FstObjectOutput.java | 4 ++- .../serialize/fst/FstSerialization.java | 7 ++++++ .../hessian2/Hessian2ObjectInput.java | 2 +- .../hessian2/Hessian2ObjectOutput.java | 2 +- .../hessian2/Hessian2Serialization.java | 7 ++++++ .../java/CompactedJavaSerialization.java | 7 ++++++ .../java/CompactedObjectInputStream.java | 2 +- .../java/CompactedObjectOutputStream.java | 2 +- .../serialize/java/JavaObjectInput.java | 2 +- .../serialize/java/JavaObjectOutput.java | 2 +- .../serialize/java/JavaSerialization.java | 7 ++++++ .../nativejava/NativeJavaObjectInput.java | 3 +++ .../nativejava/NativeJavaObjectOutput.java | 3 +++ .../nativejava/NativeJavaSerialization.java | 7 ++++++ .../serialize/kryo/KryoObjectInput.java | 3 +++ .../serialize/kryo/KryoObjectOutput.java | 3 +++ .../serialize/kryo/KryoSerialization.java | 3 +++ .../protostuff/ProtostuffObjectInput.java | 3 +++ .../protostuff/ProtostuffObjectOutput.java | 3 +++ .../protostuff/ProtostuffSerialization.java | 7 ++++++ .../protostuff/delegate/TimeDelegate.java | 3 +++ .../protostuff/utils/WrapperUtils.java | 15 +++++++++++ 35 files changed, 171 insertions(+), 34 deletions(-) diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java index a8f96d3b0e9..425bb0a4ede 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Cleanable.java @@ -16,7 +16,13 @@ */ package org.apache.dubbo.common.serialize; +/** + * Interface defines that the object is cleanable. + */ public interface Cleanable { + /** + * Implementations must implement this cleanup method + */ void cleanup(); } diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataInput.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataInput.java index d122e5cfa13..7930d04d101 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataInput.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataInput.java @@ -19,7 +19,7 @@ import java.io.IOException; /** - * Data input. + * Basic data type input interface. */ public interface DataInput { diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataOutput.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataOutput.java index 36577240427..58973271542 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataOutput.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/DataOutput.java @@ -19,7 +19,7 @@ import java.io.IOException; /** - * Data output. + * Basic data type output interface. */ public interface DataOutput { @@ -98,9 +98,9 @@ public interface DataOutput { /** * Write byte array. * - * @param v value. - * @param off offset. - * @param len length. + * @param v value. + * @param off the start offset in the data. + * @param len the number of bytes that are written. * @throws IOException */ void writeBytes(byte[] v, int off, int len) throws IOException; diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectInput.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectInput.java index 81207cb720a..1d8646e880e 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectInput.java @@ -20,30 +20,37 @@ import java.lang.reflect.Type; /** - * Object input. + * Object input interface. */ public interface ObjectInput extends DataInput { /** - * read object. + * read object * - * @return object. + * @return object + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if an ClassNotFoundException occurs */ Object readObject() throws IOException, ClassNotFoundException; /** - * read object. + * read object * - * @param cls object type. - * @return object. + * @param cls object class + * @return object + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if an ClassNotFoundException occurs */ T readObject(Class cls) throws IOException, ClassNotFoundException; /** - * read object. + * read object * - * @param cls object type. - * @return object. + * @param cls object class + * @param type object type + * @return object + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if an ClassNotFoundException occurs */ T readObject(Class cls, Type type) throws IOException, ClassNotFoundException; diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectOutput.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectOutput.java index bf50167d810..73fa3b61fd5 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/ObjectOutput.java @@ -19,7 +19,7 @@ import java.io.IOException; /** - * Object output. + * Object output interface. */ public interface ObjectOutput extends DataOutput { diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Serialization.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Serialization.java index eb9a72e98fd..0c09df99a3d 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Serialization.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/Serialization.java @@ -25,30 +25,35 @@ import java.io.OutputStream; /** - * Serialization. (SPI, Singleton, ThreadSafe) + * Serialization strategy interface that specifies a serializer. (SPI, Singleton, ThreadSafe) + * + * The default extension is hessian2 and the default serialization implementation of the dubbo protocol. + *
+ *     e.g. <dubbo:protocol serialization="xxx" />
+ * 
*/ @SPI("hessian2") public interface Serialization { /** - * get content type id + * Get content type unique id, recommended that custom implementations use values greater than 20. * * @return content type id */ byte getContentTypeId(); /** - * get content type + * Get content type * * @return content type */ String getContentType(); /** - * create serializer + * Get a serialization implementation instance * - * @param url - * @param output + * @param url URL address for the remote service + * @param output the underlying output stream * @return serializer * @throws IOException */ @@ -56,10 +61,10 @@ public interface Serialization { ObjectOutput serialize(URL url, OutputStream output) throws IOException; /** - * create deserializer + * Get a deserialization implementation instance * - * @param url - * @param input + * @param url URL address for the remote service + * @param input the underlying input stream * @return deserializer * @throws IOException */ diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistry.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistry.java index 2ebb3a3c7fd..22de45d5c74 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistry.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistry.java @@ -21,6 +21,10 @@ import java.util.LinkedHashMap; import java.util.Map; +/** + * Provide a unified serialization registry, this class used for {@code dubbo-serialization-fst} + * and {@code dubbo-serialization-kryo}, it will register some classes at startup time (for example {@link AbstractKryoFactory#create}) + */ public abstract class SerializableClassRegistry { @@ -28,6 +32,8 @@ public abstract class SerializableClassRegistry { /** * only supposed to be called at startup time + * + * @param clazz object type */ public static void registerClass(Class clazz) { registerClass(clazz, null); @@ -35,6 +41,9 @@ public static void registerClass(Class clazz) { /** * only supposed to be called at startup time + * + * @param clazz object type + * @param serializer object serializer */ public static void registerClass(Class clazz, Serializer serializer) { if (clazz == null) { @@ -43,6 +52,11 @@ public static void registerClass(Class clazz, Serializer serializer) { registrations.put(clazz, serializer); } + /** + * get registered classes + * + * @return class serializer + * */ public static Map getRegisteredClasses() { return registrations; } diff --git a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializationOptimizer.java b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializationOptimizer.java index 7085f2de89a..b043f3448f8 100644 --- a/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializationOptimizer.java +++ b/dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializationOptimizer.java @@ -19,10 +19,14 @@ import java.util.Collection; /** - * This class can be replaced with the contents in config file, but for now I think the class is easier to write - * + * Interface defining serialization optimizer, there are nothing implementations for now. */ public interface SerializationOptimizer { + /** + * Get serializable classes + * + * @return serializable classes + * */ Collection getSerializableClasses(); } diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInput.java b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInput.java index 96824fd58cf..1a38f277dc7 100644 --- a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInput.java @@ -29,6 +29,9 @@ import java.io.Reader; import java.lang.reflect.Type; +/** + * FastJson object input implementation + */ public class FastJsonObjectInput implements ObjectInput { private final BufferedReader reader; diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutput.java b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutput.java index d0e4ed546e9..3f9ec2083da 100644 --- a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutput.java @@ -28,6 +28,9 @@ import java.io.PrintWriter; import java.io.Writer; +/** + * FastJson object output implementation + */ public class FastJsonObjectOutput implements ObjectOutput { private final PrintWriter writer; diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerialization.java b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerialization.java index 189ef0b0b86..097587132c7 100644 --- a/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerialization.java +++ b/dubbo-serialization/dubbo-serialization-fastjson/src/main/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerialization.java @@ -25,6 +25,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * FastJson serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="fastjson" />
+ * 
+ */ public class FastJsonSerialization implements Serialization { @Override diff --git a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstFactory.java b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstFactory.java index b0830332b52..e41c358b43e 100644 --- a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstFactory.java +++ b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstFactory.java @@ -25,6 +25,9 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Fst object input/output factory + */ public class FstFactory { private static final FstFactory factory = new FstFactory(); diff --git a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectInput.java b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectInput.java index b94a85f2fd8..51e8340a988 100644 --- a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectInput.java @@ -24,7 +24,9 @@ import java.io.InputStream; import java.lang.reflect.Type; - +/** + * Fst object input implementation + */ public class FstObjectInput implements ObjectInput { private FSTObjectInput input; diff --git a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectOutput.java b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectOutput.java index 46fee0b3aa0..a2c40e5d0da 100644 --- a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstObjectOutput.java @@ -23,7 +23,9 @@ import java.io.IOException; import java.io.OutputStream; - +/** + * Fst object output implementation + */ public class FstObjectOutput implements ObjectOutput { private FSTObjectOutput output; diff --git a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstSerialization.java b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstSerialization.java index 89881df3969..e8b984c8bba 100644 --- a/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstSerialization.java +++ b/dubbo-serialization/dubbo-serialization-fst/src/main/java/org/apache/dubbo/common/serialize/fst/FstSerialization.java @@ -25,6 +25,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Fst serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="fst" />
+ * 
+ */ public class FstSerialization implements Serialization { @Override diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java index 348d04d9913..d1ef21402c7 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java @@ -25,7 +25,7 @@ import java.lang.reflect.Type; /** - * Hessian2 Object input. + * Hessian2 object input implementation */ public class Hessian2ObjectInput implements ObjectInput { private final Hessian2Input mH2i; diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectOutput.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectOutput.java index fec356a668a..38fd3db0b27 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectOutput.java @@ -24,7 +24,7 @@ import java.io.OutputStream; /** - * Hessian2 Object output. + * Hessian2 object output implementation */ public class Hessian2ObjectOutput implements ObjectOutput { private final Hessian2Output mH2o; diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2Serialization.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2Serialization.java index 71c6233659c..225df10908a 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2Serialization.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2Serialization.java @@ -25,6 +25,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Hessian2 serialization implementation, hessian2 is the default serialization protocol for dubbo + * + *
+ *     e.g. <dubbo:protocol serialization="hessian2" />
+ * 
+ */ public class Hessian2Serialization implements Serialization { public static final byte ID = 2; diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java index 9573ed77891..8222ac45091 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java @@ -25,6 +25,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Compacted java serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="compactedjava" />
+ * 
+ */ public class CompactedJavaSerialization implements Serialization { @Override diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java index a6bda0aca99..2ed71f814ec 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java @@ -26,7 +26,7 @@ import java.io.StreamCorruptedException; /** - * Compacted java object input stream. + * Compacted java object input implementation */ public class CompactedObjectInputStream extends ObjectInputStream { private ClassLoader mClassLoader; diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java index 2bbf42e97eb..56847e5e254 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java @@ -22,7 +22,7 @@ import java.io.OutputStream; /** - * Compacted java object output stream. + * Compacted java object output implementation */ public class CompactedObjectOutputStream extends ObjectOutputStream { public CompactedObjectOutputStream(OutputStream out) throws IOException { diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java index 00e712e6e97..936ab265063 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java @@ -24,7 +24,7 @@ import java.lang.reflect.Type; /** - * Java Object input. + * Java object input implementation */ public class JavaObjectInput extends NativeJavaObjectInput { public final static int MAX_BYTE_ARRAY_LENGTH = 8 * 1024 * 1024; diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java index 49a4b45123f..0e78747c919 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java @@ -23,7 +23,7 @@ import java.io.OutputStream; /** - * Java Object output. + * Java object output implementation */ public class JavaObjectOutput extends NativeJavaObjectOutput { public JavaObjectOutput(OutputStream os) throws IOException { diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java index 72d9ef3a94d..bf98818fd43 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java @@ -25,6 +25,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Java serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="java" />
+ * 
+ */ public class JavaSerialization implements Serialization { @Override diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java index a01f1ebaa73..c791250f7af 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java @@ -25,6 +25,9 @@ import java.io.ObjectInputStream; import java.lang.reflect.Type; +/** + * Native java object input implementation + */ public class NativeJavaObjectInput implements ObjectInput { private final ObjectInputStream inputStream; diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java index 89f8145a68f..2ff82f76c36 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java @@ -24,6 +24,9 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; +/** + * Native java object output implementation + */ public class NativeJavaObjectOutput implements ObjectOutput { private final ObjectOutputStream outputStream; diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java index 3b692487445..55198690607 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java @@ -26,6 +26,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Native java serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="nativejava" />
+ * 
+ */ public class NativeJavaSerialization implements Serialization { public static final String NAME = "nativejava"; diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectInput.java b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectInput.java index fcfc91a4fe5..91648e5c628 100644 --- a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectInput.java @@ -28,6 +28,9 @@ import java.io.InputStream; import java.lang.reflect.Type; +/** + * Kryo object input implementation, kryo object can be clean + */ public class KryoObjectInput implements ObjectInput, Cleanable { private Kryo kryo; diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectOutput.java b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectOutput.java index ef2f219acd7..dd127005fe8 100644 --- a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoObjectOutput.java @@ -26,6 +26,9 @@ import java.io.IOException; import java.io.OutputStream; +/** + * Kryo object output implementation, kryo object can be clean + */ public class KryoObjectOutput implements ObjectOutput, Cleanable { private Output output; diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoSerialization.java b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoSerialization.java index 7ff6617a704..aa10df4af90 100644 --- a/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoSerialization.java +++ b/dubbo-serialization/dubbo-serialization-kryo/src/main/java/org/apache/dubbo/common/serialize/kryo/KryoSerialization.java @@ -28,6 +28,9 @@ /** * TODO for now kryo serialization doesn't deny classes that don't implement the serializable interface * + *
+ *     e.g. <dubbo:protocol serialization="kryo" />
+ * 
*/ public class KryoSerialization implements Serialization { diff --git a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectInput.java b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectInput.java index 0202762cfa2..6284d6a6777 100644 --- a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectInput.java @@ -29,6 +29,9 @@ import java.io.InputStream; import java.lang.reflect.Type; +/** + * Protostuff object input implementation + */ public class ProtostuffObjectInput implements ObjectInput { private DataInputStream dis; diff --git a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectOutput.java b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectOutput.java index 2e91d17ef6f..3e54282a6b4 100644 --- a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffObjectOutput.java @@ -29,6 +29,9 @@ import java.io.IOException; import java.io.OutputStream; +/** + * Protostuff object output implementation + */ public class ProtostuffObjectOutput implements ObjectOutput { private LinkedBuffer buffer = LinkedBuffer.allocate(); diff --git a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffSerialization.java b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffSerialization.java index aaf5bddc36d..acdeaeaff4c 100644 --- a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffSerialization.java +++ b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/ProtostuffSerialization.java @@ -26,6 +26,13 @@ import java.io.InputStream; import java.io.OutputStream; +/** + * Protostuff serialization implementation + * + *
+ *     e.g. <dubbo:protocol serialization="protostuff" />
+ * 
+ */ public class ProtostuffSerialization implements Serialization { @Override public byte getContentTypeId() { diff --git a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/delegate/TimeDelegate.java b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/delegate/TimeDelegate.java index 8cc33c7d0be..6ead01827e2 100644 --- a/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/delegate/TimeDelegate.java +++ b/dubbo-serialization/dubbo-serialization-protostuff/src/main/java/org/apache/dubbo/common/serialize/protostuff/delegate/TimeDelegate.java @@ -26,6 +26,9 @@ import java.io.IOException; import java.sql.Time; +/** + * Custom {@link Time} delegate + */ public class TimeDelegate implements Delegate