Is it not that whenever you close OIS#1 (as you do in step 3) close call
is passed to underlying inputstream which would close actual tcp
inputstream passed up by jgroups layer? We need some "end of in-memory
state" marker?
I was thinking there might be an issue with this:
1) StateTransferIntegrator gets InputStream IS from the JGroups layer.
2) Uses it to create ObjectInputStream OIS#1. Uses that to
read off the in-memory state and any marker we insert in the stream.
3) Closes OIS#1.
4) Passes IS to the cache loader.
5) Cacheloader creates ObjectInputStream OIS#2 from IS.
Reads the persistent state.
Maybe that will work fine; it would be good if it did as it
allows for a more flexible API.