/** * Creates a new bandwidth throttle at the given throttle rate. * The default windows size T is used. The bytes per windows N * is calculated from bytesPerSecond. * * @param bytesPerSecond the limits in bytes (not bits!) per second * (not milliseconds!) */ public BandwidthThrottle(float bytesPerSecond) { this.setRate(bytesPerSecond); }
/** * @param bytesPerSecond Maximum number of bytes to transfer by second */ public void setBandwidth(final float bytesPerSecond) { if(log.isDebugEnabled()) { log.debug(String.format("Throttle bandwidth to %s bytes per second", bytesPerSecond)); } bandwidth.setRate(bytesPerSecond); }
/** * Creates a new bandwidth throttle at the given throttle rate, * only allowing bandwidth to be used every other second if * switching is true. * The default windows size T is used. The bytes per windows N * is calculated from bytesPerSecond. * * @param bytesPerSecond the limits in bytes (not bits!) per second * (not milliseconds!) * @param switching true if we should only allow bandwidth to be used * every other second. */ public BandwidthThrottle(float bytesPerSecond, boolean switching) { this.setRate(bytesPerSecond); this.setSwitching(switching); }
transfer.getBandwidth().setRate(Float.parseFloat(bandwidthObj.toString()));