private static void serializeObjectByKryo(Kryo kryo, Object plan, OutputStream out) {
    Output output = new Output(out);
    kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader());
    kryo.writeObject(output, plan);
    output.close();
  }
@param plan Usually of type MapredWork, MapredLocalWork etc.
@param out stream in which serialized plan is written into
ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java