[ 
https://issues.apache.org/jira/browse/HIVE-24115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hao updated HIVE-24115:
-----------------------
    Description: 
DefaultInstantiatorStrategy is the recommended way of creating objects with 
Kryo. It runs constructors just like would be done with Java code. Alternative, 
extralinguistic mechanisms can also be used to create objects. The 
[Objenesis|http://objenesis.org/] StdInstantiatorStrategy uses JVM specific 
APIs to create an instance of a class without calling any constructor at all. 
Using this is dangerous because most classes expect their constructors to be 
called. Creating the object by bypassing its constructors may leave the object 
in an uninitialized or invalid state. Classes must be designed to be created in 
this way.

Kryo can be configured to try DefaultInstantiatorStrategy first, then fallback 
to StdInstantiatorStrategy if necessary

like :

kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new 
StdInstantiatorStrategy()));

  was:DefaultInstantiatorStrategy is the recommended way of creating objects 
with Kryo. It runs constructors just like would be done with Java code. 
Alternative, extralinguistic mechanisms can also be used to create objects. The 
[Objenesis|http://objenesis.org/] StdInstantiatorStrategy uses JVM specific 
APIs to create an instance of a class without calling any constructor at all. 
Using this is dangerous because most classes expect their constructors to be 
called. Creating the object by bypassing its constructors may leave the object 
in an uninitialized or invalid state. Classes must be designed to be created in 
this way.


> Kryo's instantiation strategy should use the DefaultInstantiatorStrategy  
> instead of the dangerous StdInstantiatorStrategy
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-24115
>                 URL: https://issues.apache.org/jira/browse/HIVE-24115
>             Project: Hive
>          Issue Type: Wish
>            Reporter: hao
>            Priority: Minor
>
> DefaultInstantiatorStrategy is the recommended way of creating objects with 
> Kryo. It runs constructors just like would be done with Java code. 
> Alternative, extralinguistic mechanisms can also be used to create objects. 
> The [Objenesis|http://objenesis.org/] StdInstantiatorStrategy uses JVM 
> specific APIs to create an instance of a class without calling any 
> constructor at all. Using this is dangerous because most classes expect their 
> constructors to be called. Creating the object by bypassing its constructors 
> may leave the object in an uninitialized or invalid state. Classes must be 
> designed to be created in this way.
> Kryo can be configured to try DefaultInstantiatorStrategy first, then 
> fallback to StdInstantiatorStrategy if necessary
> like :
> kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new 
> StdInstantiatorStrategy()));



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to