You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/07/27 05:09:57 UTC

[GitHub] lovepoem commented on issue #2132: Dubbo序列化多个 CopyOnWriteArrayList 对象, 反序列化后得到的对象变成同一个!

lovepoem commented on issue #2132: Dubbo序列化多个 CopyOnWriteArrayList 对象, 反序列化后得到的对象变成同一个!
URL: https://github.com/apache/incubator-dubbo/issues/2132#issuecomment-408313078
 
 
   Now the dubbo use hessian serialize component  by default
   ```java
   
   @Test
   public void testListSerializer() throws Exception {
   
       List<Integer> list = new CopyOnWriteArrayList<>();
       list.add(1111);
       list.add(2222);
       List<Integer> list2 = new CopyOnWriteArrayList<>();
       list2.add(1111);
       list2.add(2222);
      // Assert.assertTrue(list==list2);
       List deserialize = baseHessianSerialize(list);
       List deserialize2 = baseHessianSerialize(list2);
       Assert.assertTrue(deserialize.equals(list));
       Assert.assertTrue(deserialize==deserialize2);
   }
   
   /**
    * hessian serialize util
    *
    * @param data
    * @param <T>
    * @return
    * @throws IOException
    */
   provite <T> T baseHessianSerialize(T data) throws IOException {
       ByteArrayOutputStream bout = new ByteArrayOutputStream();
       HessianOutput out = new HessianOutput(bout);
   
       out.writeObject(data);
       out.flush();
   
       ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
       HessianInput input = new HessianInput(bin);
       return (T) input.readObject();
   }
   
   
   ```
   Your problem can't be reproduced
   
   Ian Luo <no...@github.com> 于2018年7月27日周五 下午12:36写道:
   
   > where's GenericObjectInput introduced?
   >
   > —
   > You are receiving this because you are subscribed to this thread.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/incubator-dubbo/issues/2132#issuecomment-408308938>,
   > or mute the thread
   > <https://github.com/notifications/unsubscribe-auth/AAye6IICOjt1Y0VYZShwfAfEZIcJ3gS6ks5uKpjrgaJpZM4VfW-5>
   > .
   >
   

----------------------------------------------------------------
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