private void run(ChannelHandlerContext ctx) {
        if (drainFuture != null) {
            final boolean cancelled;
            if (drainFuture.getDelay(TimeUnit.MICROSECONDS) > drainDurationMicros) {
                // Maybe reschedule below.
                cancelled = drainFuture.cancel(false);
            } else {
                cancelled = false;
            }

            if (cancelled) {
                drainFuture = null;
            } else {
                // Drain is already scheduled to finish earlier.
                return;
            }
        }
        if (drainDurationMicros > 0) {
            if (canCallOnDrainStart) {
                onDrainStart(ctx);
            }
            drainFuture = ctx.executor().schedule(() -> finish(ctx),
                                                  drainDurationMicros, TimeUnit.MICROSECONDS);
        } else {
            finish(ctx);
        }
        canCallOnDrainStart = false;
    }
Code executed on the connection drain end. Executed at most once.
core/src/main/java/com/linecorp/armeria/internal/common/GracefulConnectionShutdownHandler.java