dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] kennyliao1982 opened a new issue #2178: please consider supporting Java 8 Date/Time type when serializing with Kryo
Date Fri, 03 Aug 2018 06:43:42 GMT
kennyliao1982 opened a new issue #2178: please consider supporting Java 8 Date/Time type when
serializing with Kryo
URL: https://github.com/apache/incubator-dubbo/issues/2178
 
 
   ### Environment
   
   * Dubbo version: 2.6.2
   * Java version: 1.8
   
   I am using java.time.LocalDateTime and Dubbo complains "**class java.time.LocalDateTime
has no zero-arg constructor and this will affect the serialization performance**", which is
caused by Dubbo's wrapper class "**CompatibleKryo**"
   
   Any thoughts ??
   
   ```
   package com.alibaba.dubbo.common.serialize.kryo;
   
   import com.alibaba.dubbo.common.logger.Logger;
   import com.alibaba.dubbo.common.logger.LoggerFactory;
   import com.alibaba.dubbo.common.serialize.kryo.utils.ReflectionUtils;
   
   import com.esotericsoftware.kryo.Kryo;
   import com.esotericsoftware.kryo.Serializer;
   import com.esotericsoftware.kryo.serializers.JavaSerializer;
   
   public class CompatibleKryo extends Kryo {
   
       private static final Logger logger = LoggerFactory.getLogger(CompatibleKryo.class);
   
       @Override
       public Serializer getDefaultSerializer(Class type) {
           if (type == null) {
               throw new IllegalArgumentException("type cannot be null.");
           }
   
           if (!type.isArray() && !type.isEnum() && !ReflectionUtils.checkZeroArgConstructor(type))
{
               if (logger.isWarnEnabled()) {
                   logger.warn(type + " has no zero-arg constructor and this will affect the
serialization performance");
               }
               return new JavaSerializer();
           }
           return super.getDefaultSerializer(type);
       }
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message