static byte[] serialize(Object obj){
  try (ByteArrayOutputStream b=new ByteArrayOutputStream()){
    try (ObjectOutputStream o=new ObjectOutputStream(b)){
      o.writeObject(obj);
    }
     return b.toByteArray();
  }
 catch (  Exception e) {
    throw new IgniteException("Failed to serialize object to byte array [obj=" + obj,e);
  }
}

static byte [ ] serialize ( Object obj ) { try ( ByteArrayOutputStream b = new ByteArrayOutputStream ( ) ) { try ( ObjectOutputStream o = new ObjectOutputStream ( b ) ) { o . writeObject ( obj ) ; } return b . toByteArray ( ) ; } catch ( Exception e ) { throw new IgniteException ( "Failed to serialize object to byte array [obj=" + obj , e ) ; } }
turns given arbitrary object to byte array .
