public boolean acquire(final Object o, final long timeout,
                           final TimeUnit unit) throws InterruptedException {
        if (Objects.isNull(o)) {
            throw new NullPointerException();
        }
        long nanos = unit.toNanos(timeout);
        acquireLock.lockInterruptibly();
        try {
            final long objectSize = inst.getObjectSize(o);
            while (memory.sum() + objectSize >= memoryLimit) {
                if (nanos <= 0) {
                    return false;
                }
                nanos = notLimited.awaitNanos(nanos);
            }
            memory.add(objectSize);
            if (memory.sum() < memoryLimit) {
                notLimited.signal();
            }
        } finally {
            acquireLock.unlock();
        }
        if (memory.sum() > 0) {
            signalNotEmpty();
        }
        return true;
    }
acquire memory by {@link Object}.
this method response to interrupts.

@param o       memory size to be applied by calculating
@param timeout max time to wait
@param unit    time unit
@return true if acquire success
@throws InterruptedException the InterruptedException
shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/MemoryLimiter.java