private Method reflectHflushOrSync()

in flume-hdfs-sink/src/main/java/org/apache/flume/sink/hdfs/AbstractHDFSWriter.java [235:254]


  private Method reflectHflushOrSync(FSDataOutputStream os) {
    Method m = null;
    if (os != null) {
      Class<?> fsDataOutputStreamClass = os.getClass();
      try {
        m = fsDataOutputStreamClass.getMethod("hflush");
      } catch (NoSuchMethodException ex) {
        logger.debug("HFlush not found. Will use sync() instead");
        try {
          m = fsDataOutputStreamClass.getMethod("sync");
        } catch (Exception ex1) {
          String msg = "Neither hflush not sync were found. That seems to be " +
              "a problem!";
          logger.error(msg);
          throw new FlumeException(msg, ex1);
        }
      }
    }
    return m;
  }