Skip to content

Conversation

AgraVator
Copy link
Contributor

@AgraVator AgraVator commented Sep 8, 2025

Finishes the remaining work of A94

@AgraVator AgraVator requested a review from ejona86 September 8, 2025 22:35
@GuardedBy("this")
void notifyShutdown(Status status) {
clientTransportListener.transportShutdown(status);
clientTransportListener.transportShutdown(status, SimpleDisconnectError.SUBCHANNEL_SHUTDOWN);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UNKNOWN ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely isn't SUBCHANNEL_SHUTDOWN. I think it is fair to use UNKNOWN, because the transport would need to be instrumented to know better.

@GuardedBy("this")
void notifyShutdown(Status status) {
clientTransportListener.transportShutdown(status);
clientTransportListener.transportShutdown(status, SimpleDisconnectError.SUBCHANNEL_SHUTDOWN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely isn't SUBCHANNEL_SHUTDOWN. I think it is fair to use UNKNOWN, because the transport would need to be instrumented to know better.

*
*/
@ThreadSafe
public interface ClientTransportWithDisconnectReason extends ClientTransport {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used as part of the KeepAliveManager API, so move it there. And then it would be named relative to that API, like Transport if within ClientKeepAlivePinger.

(This is probably the only remaining use of ping() as well, so we'll probably end up moving ping() from ClientTransport to this interface as well, as which point it won't extend ClientTransport.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OkHttpClientTransport and NettyClientTransport will implement it as well....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they are users of the ClientKeepAlivePinger API...


@Override
public void shutdownNow(final Status reason) {
shutdownNow(reason, SimpleDisconnectError.UNKNOWN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUBCHANNEL_SHUTDOWN

@Override
public void run() {
lifecycleManager.notifyShutdown(reason);
lifecycleManager.notifyShutdown(reason, SimpleDisconnectError.SUBCHANNEL_SHUTDOWN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disconnectError


@Override
public void shutdownNow(Status reason) {
shutdownNow(reason, SimpleDisconnectError.UNKNOWN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUBCHANNEL_SHUTDOWN


@Override
public void shutdownNow(Status reason, DisconnectError disconnectError) {
shutdown(reason);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disconnectError looks like it should be passed to be passed to shutdown.

ArgumentCaptor<Status> captor = ArgumentCaptor.forClass(Status.class);
verify(listener, timeout(TIME_OUT_MS)).transportShutdown(captor.capture());
verify(listener, timeout(TIME_OUT_MS)).transportShutdown(captor.capture(),
any(DisconnectError.class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to consider verifying the DisconnectError as well, for this and the other three below that use captor.capture().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants