Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,17 @@ public void endTxn(OpRequestSend op) {
}
} else {
Throwable cause = FutureUtil.unwrapCompletionException(ex);
log.error("endTxn error topic: [{}]", op.topic, cause);
if (cause instanceof PulsarClientException.BrokerMetadataException) {
op.cb.complete(null);
if (cause instanceof PulsarClientException.ConnectFailedException) {
log.warn("Client connection already closed, topic: [{}]", op.topic);
op.cb.completeExceptionally(cause);
} else {
op.cb.completeExceptionally(
new PulsarClientException.LookupException(cause.getMessage()));
log.error("endTxn error topic: [{}]", op.topic, cause);
if (cause instanceof PulsarClientException.BrokerMetadataException) {
op.cb.complete(null);
} else {
op.cb.completeExceptionally(
new PulsarClientException.LookupException(cause.getMessage()));
}
}
onResponse(op);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ public InvalidServiceURL(String msg, Throwable t) {
}
}

/**
* Clients are unable to connect to the broker.
*/
public static class ConnectFailedException extends PulsarClientException {
public ConnectFailedException(String msg) {
super(msg);
}
}

/**
* Invalid Configuration exception thrown by Pulsar client.
*/
Expand Down Expand Up @@ -1127,6 +1136,8 @@ public static PulsarClientException unwrap(Throwable t) {
newException = new NotFoundException(msg);
} else if (cause instanceof TransactionHasOperationFailedException) {
newException = new TransactionHasOperationFailedException(msg);
} else if (cause instanceof ConnectFailedException) {
newException = new ConnectFailedException(msg);
} else {
newException = new PulsarClientException(t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
lastDisconnectedTimestamp = System.currentTimeMillis();
log.info("{} Disconnected", ctx.channel());
if (!connectionFuture.isDone()) {
connectionFuture.completeExceptionally(new PulsarClientException("Connection already closed"));
connectionFuture.completeExceptionally(
new PulsarClientException.ConnectFailedException("Connection already closed"));
}

ConnectException e = new ConnectException(
Expand Down
Loading