Giter Site home page Giter Site logo

Comments (1)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Ok this seems quite fundamental so I'm assuming it's my lack of Java knowledge 
and is known, if strange, behaviour, rather than a bug. But as far as I can 
see, SpyMemcached uses an ObjectInputStream/OutputStream to 
serialize/deserialize any java objects it is sent (I'm looking in 
BaseSerializingTranscoder.java, lines 95-144).

So I tried serializing a java.util.HashMap containing a boolean value using an 
ObjectInputStream, then deserialized it using an ObjectOutputStream, and got 
the same problem - a new instance of java.lang.Boolean is created. Here's my 
REPL session (again, apologies for the non-Java):

user=> (def bos (ByteArrayOutputStream.))
#'user/bos

user=> (def os (ObjectOutputStream. bos))
#'user/os

user=> (def hm (HashMap.))
#'user/hm

user=> (.put hm "abc" false)
nil

user=> (.get hm "abc")
false

user=> (identical? false (.get hm "abc"))
true

user=> (.writeObject os hm)
nil

user=> (def ba (.toByteArray bos))
#'user/ba

user=> ba
#<byte[] [B@737e2e57>

user=> (def bis (ByteArrayInputStream. ba))
#'user/bis

user=> (def is (ObjectInputStream. bis))
#'user/is

user=> (def newhm (.readObject is))
#'user/newhm

user=> (.get newhm "abc")
false

user=> (identical? false (.get newhm "abc"))
false

Original comment by [email protected] on 14 Apr 2015 at 5:59

from spymemcached.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.