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

Aleksey Plekhanov edited comment on IGNITE-12468 at 1/28/20 9:18 AM:
---------------------------------------------------------------------

Fix is ready. [~Pavlukhin] as binary objects expert, can you please have a look?

This ticket only solve the problem with unwrapping binary objects, but there is 
still a couple of issues left:
 # Comparison of values performed by {{F.eq}} method, which returns false for 
arrays, even with equal content. It also affects thick clients. I've filed the 
ticket IGNITE-12578.
 # There is a fundamental issue with thin client marshaling. For each operation 
marshaling/unmarshaling performed twice. For example, cache put operation 
marshal object on the client-side, then unmarshal object (with keep binaries) 
on the server-side and marshal it again before putting it to the cache. It 
causes some undesirable effects. For example, references to the same binary 
object in a collection ( {{new ArrayList(Arrays.asList(person, person))}} ) 
deserialized as different objects. Also, with binary object full array of this 
object is marshaled, but object takes only some part of this array, it causes 
size overhead for storing these objects. Some of these problems can be solved 
if we will construct {{CacheObject}} from request content and put it directly 
to cache without unmarshaling/marshaling, but we don't have object size in thin 
client protocol, so in any case, we need to traverse the objects. Also, we 
don't have the ability to get CacheObject from the cache now, so such an 
approach will only work in one way, for put operations, but not get operations. 
I will investigate this issue and file a ticket later. Prehaps, it also should 
be discussed on dev-list.

 


was (Author: alex_pl):
Fix is ready. [~Pavlukhin] as binary objects expert, can you please have a look?

This ticket only solve the problem with unwrapping binary objects, but there is 
still a couple of issues left:
 # Comparison of values performed by {{F.eq}} method, which returns false for 
arrays, even with equal content. It also affects thick clients. I've filed the 
ticket IGNITE-12578.
 # There is a fundamental issue with thin client marshaling. For each operation 
marshaling/unmarshaling performed twice. For example, cache put operation 
marshal object on the client-side, then unmarshal object (with keep binaries) 
on the server-side and marshal it again before putting it to the cache. It 
causes some undesirable effects. For example, references to the same binary 
object in a collection ( {{new ArrayList(Arrays.asList(person, person))}} ) 
deserialized as different objects. Also, with binary object full array of this 
object is marshaled, but object takes only some part of this array, it causes 
size overhead for storing these objects. Some of these problems can be solved 
if we sill construct {{CacheObject}} from request content and put it directly 
to cache without unmarshaling/marshaling, but we don't have object size in thin 
client protocol, so in any case, we need to traverse the objects. Also, we 
don't have the ability to get CacheObject from the cache now, so such an 
approach will only work for put operations, but not get operations. I will 
investigate this issue and file a ticket later. Prehaps, it also should be 
discussed on dev-list.

 

> ClassCastException on thinClient in Apache Ignite
> -------------------------------------------------
>
>                 Key: IGNITE-12468
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12468
>             Project: Ignite
>          Issue Type: Bug
>          Components: binary, clients, thin client
>    Affects Versions: 2.6
>            Reporter: LEE PYUNG BEOM
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>
>  
> {code:java}
>     ClientConfiguration cfg = new 
> ClientConfiguration().setAddresses("127.0.0.1:10800");
>     try (IgniteClient igniteClient = Ignition.startClient(cfg)) {
>         System.out.println(">>> Thin client put-get example started.");
>         final String CACHE_NAME = "put-get-example";
>         ClientCache<Integer, Object> cache = 
> igniteClient.getOrCreateCache(CACHE_NAME);
>         Person p = new Person();
>         //put
>         HashMap<Integer, Person> hm = new HashMap<Integer, Person>();
>         hm.put(1, p);
>         cache.put(1, hm);
>         //get
>         HashMap<Integer, Person> map = (HashMap<Integer, Person>)cache.get(1);
>         Person p2 = map.get(1);
>         System.out.format(">>> Loaded [%s] from the cache.\n",p2);
>     }
>     catch (ClientException e) {
>         System.err.println(e.getMessage());
>         e.printStackTrace();
>     }
>     catch (Exception e) {
>         System.err.format("Unexpected failure: %s\n", e);
>         e.printStackTrace();
>     }
> {code}
>  
> I use the thin client of apache-ignite.
> I Create a hashmap and put the Person 
> class(org.apache.ignite.examples.model.Person) object into it.
> And when I take it out of the hashmap, I get the following exceptions:
>  
> {code:java}
> > java.lang.ClassCastException:
> > org.apache.enite.internal.binary.BinaryObjectImpl cannot be cast to
> > org.apache.engite.examples.model.Person.
> {code}
> An exception is given in the code below.
>  
> {code:java}
> Person p2 = map.get(1);
> {code}
>  
> However, there is no exception if I modify the code as follows:
>  
> {code:java}
> BinaryObject bo = (BinaryObject) map.get(1);
> Person p2 = bo.deserialize();
> {code}
> I don't think that's necessary. Is there another solution?
>  



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

Reply via email to