Unlike Guarded Suspension pattern that waits until guard condition meets, Balking pattern returns from executing without waiting.

Balking Pattern Example

Guarded Time Example – wait(n)
Balking after waiting for some specific amount of time is called as guarded timed or timeout.
In Java, as there is no way to distinguish a thread whether it is awaken by timeout, we need an additional code to implement that.

- When it times out, the thread will perform
whileloop again and throws TimeoutException

Leave a comment