Hi Colin,

On 11 May 2014 at 19:55:10, Colin Godsey ([email protected]) wrote:

I'm having issues where a certain form of akka.util.ByteString isn't 
serializable (ByteString1). It is the sliced version of a ByteString based off 
of a byte array. I understand that wrapping a byte Array breaks the mutability 
guarantee and etc... but that is ignored sometimes with Arrays and such. 
ByteString's 'contract' states that it is an immutable object and and will 
never change... and that should be its end behavior. 

So I guess I don't understand why just this one form of ByteString doesnt 
serialize? If I cast the array to a Seq[Byte] using the java->scala implicits 
and concat that to a ByteString... it works fine (and as far as I know is still 
referencing the original array).

I guess I always assumed that all immutable instances of Seq really should just 
serialize out (although I guess SeqView doesnt either, but thats a bit more 
specific). Any justification or clarification for me?


The ByteString class itself isn't serializable. Only a subcategory called 
CompactByteString (things referencing a contiguous chunk of memory) is 
serializable. Why this difference was introduced isn't clear from the comments 
or the pull request.

There is also the question of what it exactly means to serialize a ByteString. 
Do you expect it to become one big contiguous array automatically?

One way to get something serializable is to compact your ByteString.

I've opened a ticket to investigate this further 
https://github.com/akka/akka/issues/15170

B/


https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/util/ByteString.scala
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

JOIN US. REGISTER TODAY!
Scala
Days
June 16th-18th,
Berlin

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to