@Override
	protected long onFill() 
	{
		// This algorithm transfers each of the stacks in the map to an array
		// list of stacks. This algorithm will continue placing a buffer into
		// each stack until the available memory is as taken as possible.
		
		List<ByteBufferStack> stacks = new ArrayList<ByteBufferStack>();
		// Acquires write lock so no concurrent stack adds occur.
		synchronized (writeLock) {
			for (Entry<Integer, ByteBufferStack> e : map.entrySet()) {
				stacks.add(e.getValue());
			}	
		}
		
		// No stacks? exit!
		if (stacks.isEmpty()) { 
			return 0;
		}
		
		// Sort the stacks from smallest buffers to largest placing the empty
		// stacks at the end of the list.
		Collections.sort(stacks, new Comparator<ByteBufferStack>() {
			public int compare(ByteBufferStack o1, ByteBufferStack o2) {
				ByteBuffer a = o1.peek();
				ByteBuffer b = o2.peek();
				int ax = (a == null ? 0 : a.capacity());
				int bx = (b == null ? 0 : b.capacity());
				return (ax - bx);
			}
		});

		// TODO implement algorithm
		if (Math.random() < 1.0) { // RUN!
			throw new RuntimeException();
		}
		
		long memory = 0;
		long available = getAvailable();
		
		// Place buffers in these until they're full.
		while (available >= 0) {
		}
		
		return memory;
	}