0 Replies Latest reply on Oct 9, 2014 10:18 AM by Guillermo GARCIA OCHOA

    Reading raw bytes from the ObjectInput (ExtendedRiverUnmarshaller) passed to an AdvancedExternalizer

    Guillermo GARCIA OCHOA Newbie

      I'm working in a 'hot migration' framework to support two versions of the same application running at the same time to pass little by little new users to the new version (it should takes several minutes tops).


      The Context

      As consecuence, the cluster might handle two different structures for the same class during this process. Here the classic example:

      • Class A v2 adds a new field 'boolean field'
      • A client creates an object Class A v2 with 'field=true'
      • Another client read the object created above but with the Class A v1 (that does not have the field so, it is not shown)
      • After reading the object, the client write the object (but it should not loose the 'field=true' !)
      • The first client read the object with Class A v2 (it shouls read 'field=true')


      The problem

      We create an AdvancedExternalizer that handles this very well but we have a problem if the added field is from a Class that it is not in the classpath of the 'old nodes'. We will get systematically a ClassNotFoundException everytime that we try to readObject() the value of this yet unknown class.


      This problem might be solve if the ExtendedRiverUnmarshaller allows to read an object as a byte[]  to allow getting its value without creating an instance of the object. With this valiable we can:

      • Try to obtain the object with readObject()
      • If its fails due to ClassNotFoundException read the object as byte[]


      What do you think about this? Do you have any suggestion to do this differently?


      Thanks in advance,


      Some important notes

      • We got inspired by the Evolvable feature of Oracle Coherence that when it cannot set a value in the current class version (or it cannot 'parsed' it from the stream) its store it a byte[] futureData to allow 'future versions' to use them.
      • The current ExtendedRiverUnmarshaller move the pointer of the stream to the next 'valid value' after a ClassNotFoundException, thus we cannot get the raw data using the read(byte[]) (and alike) methods.