@Override
		public void run() {
			while (true) {
				try {
					nextFillTime += fillRate.getDuration().getMillis();
					long millisUntilNextFill = nextFillTime - currentTimeMillis();
					if (millisUntilNextFill > 0) {
						sleep(millisUntilNextFill);
					}
					
					int expectedAmount = fillRate.getAmount();
					if (maximumCapacity != null) {
						boolean finished = false;
						while (!finished) {
							int currentCapacity = capacity.get();
							int maxAmountToAdd = maximumCapacity - currentCapacity;
							int amountToAdd = min(expectedAmount, maxAmountToAdd);
							finished = capacity.compareAndSet(currentCapacity, currentCapacity + amountToAdd);
						}
					} else {					
						capacity.addAndGet(expectedAmount);
					}
				} catch (InterruptedException e) {
					log.info("Stopping bucket filler thread.");
					return;
				}
			}
		}