public static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit) throws IOException {
    if (fs instanceof Decorator) {
      for (Object obj : DecoratorUtils.getDecoratorLineage(fs)) {
        if (obj instanceof RateControlledFileSystem) {
          // Already rate controlled
          return fs;
        }
      }
    }

    if (qpsLimit > 0) {
      try {
        RateControlledFileSystem newFS = new RateControlledFileSystem(fs, qpsLimit);
        newFS.startRateControl();
        return newFS;
      } catch (ExecutionException ee) {
        throw new IOException("Could not create throttled FileSystem.", ee);
      }
    }
    return fs;
  }
public static FileSystem getOptionallyThrottledFileSystem ( FileSystem fs , int qpsLimit ) throws IOException { if ( fs instanceof Decorator ) { for ( Object obj : DecoratorUtils . getDecoratorLineage ( fs ) ) { if ( obj instanceof RateControlledFileSystem ) { return fs ; } } } if ( qpsLimit > 0 ) { try { RateControlledFileSystem newFS = new RateControlledFileSystem ( fs , qpsLimit ) ; newFS . startRateControl ( ) ; return newFS ; } catch ( ExecutionException ee ) { throw new IOException ( "Could not create throttled FileSystem." , ee ) ; } } return fs ; }
Get a throttled {@link FileSystem} that limits the number of queries per second to a {@link FileSystem}. If
the input qps is <= 0, no such throttling will be performed.
@throws IOException