public WatermarkDiskQuotaPolicy(List<Entry> entries){
  entries=new ArrayList<>(entries);
  Collections.sort(entries,POLICY_COMPARATOR);
  this.entries=Collections.unmodifiableList(entries);
  double lastHighWaterMark=1.0;
  double lastWorkFactor=Throttleable.MAX_WORK_FACTOR;
  for (int i=0; i < entries.size(); ++i) {
    final Entry entry=entries.get(i);
    if (lastHighWaterMark < entry.getHighWaterMarkPercent()) {
      throw new IllegalArgumentException("Policy entry " + i + " has high water mark ("+ entry.getHighWaterMarkPercent()+ ") > previous high water mark ("+ lastHighWaterMark+ "):"+ dumpPolicyEntries(entries));
    }
    if (lastWorkFactor < entry.getWorkFactor()) {
      throw new IllegalArgumentException("Policy entry " + i + " has work factor ("+ entry.getWorkFactor()+ ") < previous work factor ("+ lastWorkFactor+ "):"+ dumpPolicyEntries(entries));
    }
    if (entry.getWorkFactor() < Throttleable.MIN_WORK_FACTOR) {
      throw new IllegalArgumentException("Policy entry " + i + " has work factor ("+ entry.getWorkFactor()+ ") < minimum work factor ("+ Throttleable.MIN_WORK_FACTOR+ "):"+ dumpPolicyEntries(entries));
    }
    lastHighWaterMark=entry.getHighWaterMarkPercent();
    lastWorkFactor=entry.getWorkFactor();
  }
  log.info("Using the following disk quota enforcement entries: {}",entries.isEmpty() ? "NONE" : dumpPolicyEntries(entries));
}

public WatermarkDiskQuotaPolicy ( List < Entry > entries ) { entries = new ArrayList < > ( entries ) ; Collections . sort ( entries , POLICY_COMPARATOR ) ; this . entries = Collections . unmodifiableList ( entries ) ; double lastHighWaterMark = 1.0 ; double lastWorkFactor = Throttleable . MAX_WORK_FACTOR ; for ( int i = 0 ; i < entries . size ( ) ; ++ i ) { final Entry entry = entries . get ( i ) ; if ( lastHighWaterMark < entry . getHighWaterMarkPercent ( ) ) { throw new IllegalArgumentException ( "Policy entry " + i + " has high water mark (" + entry . getHighWaterMarkPercent ( ) + ") > previous high water mark (" + lastHighWaterMark + "):" + dumpPolicyEntries ( entries ) ) ; } if ( lastWorkFactor < entry . getWorkFactor ( ) ) { throw new IllegalArgumentException ( "Policy entry " + i + " has work factor (" + entry . getWorkFactor ( ) + ") < previous work factor (" + lastWorkFactor + "):" + dumpPolicyEntries ( entries ) ) ; } if ( entry . getWorkFactor ( ) < Throttleable . MIN_WORK_FACTOR ) { throw new IllegalArgumentException ( "Policy entry " + i + " has work factor (" + entry . getWorkFactor ( ) + ") < minimum work factor (" + Throttleable . MIN_WORK_FACTOR + "):" + dumpPolicyEntries ( entries ) ) ; } lastHighWaterMark = entry . getHighWaterMarkPercent ( ) ; lastWorkFactor = entry . getWorkFactor ( ) ; } log . info ( "Using the following disk quota enforcement entries: {}" , entries . isEmpty ( ) ? "NONE" : dumpPolicyEntries ( entries ) ) ; }
constructs a new watermark disk quota policy using the supplied policy entries .
