Process for completing an operation; This function needs to be defined in subclasses and will be called exactly once in forceComplete()
Call-back to execute when a delayed operation gets expired and hence forced to complete.
Check if the delayed operation is already completed
An operation whose processing needs to be delayed for at most the given delayMs. For example a delayed produce operation could be waiting for specified number of acks; or a delayed fetch operation could be waiting for a given number of bytes to accumulate.
The logic upon completing a delayed operation is defined in onComplete() and will be called exactly once. Once an operation is completed, isCompleted() will return true. onComplete() can be triggered by either forceComplete(), which forces calling onComplete() after delayMs if the operation is not yet completed, or tryComplete(), which first checks if the operation can be completed or not now, and if yes calls forceComplete().
A subclass of DelayedOperation needs to provide an implementation of both onComplete() and tryComplete().