@GuardedBy("lock")
private final TransmitQueue queue;
private final Long cookie;
+ private final String backendName;
@GuardedBy("lock")
private boolean haveTimer;
private volatile RequestException poisoned;
// Private constructor to avoid code duplication.
- private AbstractClientConnection(final AbstractClientConnection<T> oldConn, final TransmitQueue newQueue) {
+ private AbstractClientConnection(final AbstractClientConnection<T> oldConn, final TransmitQueue newQueue,
+ final String backendName) {
this.context = Preconditions.checkNotNull(oldConn.context);
this.cookie = Preconditions.checkNotNull(oldConn.cookie);
+ this.backendName = Preconditions.checkNotNull(backendName);
this.queue = Preconditions.checkNotNull(newQueue);
// Will be updated in finishReplay if needed.
this.lastReceivedTicks = oldConn.lastReceivedTicks;
// This constructor is only to be called by ConnectingClientConnection constructor.
// Do not allow subclassing outside of this package
- AbstractClientConnection(final ClientActorContext context, final Long cookie, final int queueDepth) {
+ AbstractClientConnection(final ClientActorContext context, final Long cookie, final String backendName,
+ final int queueDepth) {
this.context = Preconditions.checkNotNull(context);
this.cookie = Preconditions.checkNotNull(cookie);
+ this.backendName = Preconditions.checkNotNull(backendName);
this.queue = new TransmitQueue.Halted(queueDepth);
this.lastReceivedTicks = currentTime();
}
// This constructor is only to be called (indirectly) by ReconnectingClientConnection constructor.
// Do not allow subclassing outside of this package
AbstractClientConnection(final AbstractClientConnection<T> oldConn) {
- this(oldConn, new TransmitQueue.Halted(oldConn.queue, oldConn.currentTime()));
+ this(oldConn, new TransmitQueue.Halted(oldConn.queue, oldConn.currentTime()), oldConn.backendName);
}
// This constructor is only to be called (indirectly) by ConnectedClientConnection constructor.
// Do not allow subclassing outside of this package
- AbstractClientConnection(final AbstractClientConnection<T> oldConn, final T newBackend, final int queueDepth) {
+ AbstractClientConnection(final AbstractClientConnection<T> oldConn, final T newBackend,
+ final int queueDepth) {
this(oldConn, new TransmitQueue.Transmitting(oldConn.queue, queueDepth, newBackend, oldConn.currentTime(),
- Preconditions.checkNotNull(oldConn.context).messageSlicer()));
+ Preconditions.checkNotNull(oldConn.context).messageSlicer()), newBackend.getName());
}
public final ClientActorContext context() {
context.executeInActor(current -> {
final double time = beenOpen * 1.0 / 1_000_000_000;
entry.complete(entry.getRequest().toRequestFailure(
- new RequestTimeoutException(entry.getRequest() + " timed out after " + time + " seconds")));
+ new RequestTimeoutException(entry.getRequest() + " timed out after " + time
+ + " seconds. The backend for " + backendName + " is not available.")));
return current;
});
}