Blocks until the listener has returned from its last call - AgentStreamListener.onComplete or AgentStreamListener.onError - then returns the same outcome. A call whose thread is interrupted first returns a failed result (CancelledError), with the interrupt flag still set, and the turn carries on: only cancel stops it. A call from the listener itself, which would wait on itself, returns a failed result at once.
Blocks until the listener has returned from its last call - AgentStreamListener.onComplete or AgentStreamListener.onError - then returns the same outcome. A call whose thread is interrupted first returns a failed result (CancelledError), with the interrupt flag still set, and the turn carries on: only cancel stops it. A call from the listener itself, which would wait on itself, returns a failed result at once.
Cancels the turn and returns once it has ended or a 5-second bound has passed (see below); the thread is left for JAgent.streamRecover. The listener receives at most the event already being delivered, then AgentStreamListener.onError with the cancellation - or onComplete, for a turn that had already ended. Safe to call more than once, from any thread, the listener's included. An interrupt does not cut the wait short: it is kept, and the thread's flag is set again on return.
Cancels the turn and returns once it has ended or a 5-second bound has passed (see below); the thread is left for JAgent.streamRecover. The listener receives at most the event already being delivered, then AgentStreamListener.onError with the cancellation - or onComplete, for a turn that had already ended. Safe to call more than once, from any thread, the listener's included. An interrupt does not cut the wait short: it is kept, and the thread's flag is set again on return.
It waits up to 5 seconds for the turn to end, as the blocking JAgent calls do; with tracing, delivering the ended turn's last trace events can add to that. A turn whose provider ignores its interrupt for longer is logged at WARN and left to end on its own: cancel returns without it, and until it ends the thread is busy (GraphError.ThreadBusy), while await and the listener's terminal callback wait for it.