Don't try to serialize large ConcurrentSkipListMaps
Wednesday, April 16, 2008 at 4:20PM Today I learned the hard way that Java can't serialize large ConcurrentSkipListMaps (and probably ConcurrentSkipListSets too). The issue is that there doesn't seem to be any custom serialization implementation for this class, and the default serialization mechanism ends up joyfully recursing its way along the map's internal object graph - eventually causing a StackOverflowException. Nice.
The root issue here is, of course, Java's default serialization mechanism, which really shouldn't operate recursively like this. Turns out that this has been a known issue for an embarrassing length of time (see this 9 year old bug report).
The workaround is to subclass ConcurrentSkipListMap providing a more efficient serialization mechanism - actually its not too hard, the code is here. Its public domain, so enjoy!
Ian Clarke |
1 Comment |
Java,
Programming 

Reader Comments (1)
A sail veering about the blank bay waiting for a swollen designer sunglasses wholesale bundle to bob up, roll over to the sun a puffy replica sunglasses wholesale face, salt white. Here I am. They followed the winding path down to the creek. Buck Mulligan stood on a stone, in shirtsleeves, his wholesale cheap sunglasses unclipped tie rippling over his shoulder. A young man clinging to a spur of rock near him moved slowly frogwise his green sunglass wholesale legs in the deep jelly of the water. Buck Mulligan sat down to unlace his wholesale oakley sunglasses boots. An elderly man shot up near the spur of rock a blowing red sunglasses for wholesale face. He scrambled up by the stones, water glistening on his fashion sunglasses wholesale pate and on its garland of grey hair, water rilling over his chest and paunch and spilling jets out of his wholesale sunglasses china black sagging loincloth.