code: public static void distribute(Object obj, String fileName, Configuration conf) throws FileNotFoundException,
        IOException, URISyntaxException {
  
      FileSystem fS = FileSystem.get(conf);
      // set the temporary folder for Pangool instances to the temporary of the
      // user that is running the Job
      // This folder will be used across the cluster for location the instances.
      // The default value can be changed by a user-provided one.
      String tmpHdfsFolder = getInstancesFolder(fS, conf);
      Path toHdfs = new Path(tmpHdfsFolder, fileName);
      if (fS.exists(toHdfs)) { // Optionally, copy to DFS if
        fS.delete(toHdfs, false);
      }
  
      ObjectOutput out = new ObjectOutputStream(fS.create(toHdfs));
      out.writeObject(obj);
      out.close();
  
      DistributedCache.addCacheFile(toHdfs.toUri(), conf);
    }
docs: Utility method for serializing an object and saving it in a way that later
  can be recovered anywhere in the cluster.
  <p>
  The file where it has been serialized will be saved into a Hadoop
  Configuration property so that you can call
  {@link InstancesDistributor#loadInstance(Configuration, Class, String, boolean)}
  to re-instantiate the serialized instance.
  
  @param obj
  The obj instance to serialize using Java serialization.
  @param fileName
  The file name where the instance will be serialized.
  @param conf
  The Hadoop Configuration.
  @throws FileNotFoundException
  @throws IOException
  @throws URISyntaxException