@Override
	protected ByteBuffer onAllocate(int size, AtomicBoolean cache) 
	{
		// For any size thats greater then the max or less then the minimum
		// buffer sizes just create a HeapByteBuffer.
		if (size > maxSize || size < minSize) {
			try {
				return ByteBuffer.allocate(size);
			}
			catch (OutOfMemoryError e) {
				System.err.format("Cannot allocate a ByteBuffer of size %d; out of memory.\n", size);
				return null;
			}
		}
		
		// Pop a buffer off of the stack, or allocate a new one.
		ByteBuffer buffer = stack.pop();
		if (buffer == null) {
			try {
				buffer = ByteBuffer.allocateDirect(maxSize);
			}
			catch (OutOfMemoryError e) {
				System.err.format("Cannot allocate a ByteBuffer of size %d; out of memory.\n", size);
				return null;
			}
		}
		// Taken from the cache!
		else {
			cache.set(true);
		}
		return buffer;
	}