You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/02 01:49:28 UTC
[GitHub] [pulsar] Technoboy- commented on a change in pull request #14992: [improve][transaction] Use ``Caffeine`` to instead of ``Guava`` cache
Technoboy- commented on a change in pull request #14992:
URL: https://github.com/apache/pulsar/pull/14992#discussion_r840991485
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TransactionBufferHandlerImpl.java
##########
@@ -150,34 +134,30 @@ private boolean checkRequestCredits(OpRequestSend op) {
}
public void endTxn(OpRequestSend op) {
- op.cnx.whenComplete((clientCnx, throwable) -> {
- if (throwable == null) {
- if (clientCnx.ctx().channel().isActive()) {
- clientCnx.registerTransactionBufferHandler(TransactionBufferHandlerImpl.this);
- outstandingRequests.put(op.requestId, op);
- timer.newTimeout(timeout -> {
- OpRequestSend peek = outstandingRequests.remove(op.requestId);
- if (peek != null && !peek.cb.isDone() && !peek.cb.isCompletedExceptionally()) {
- peek.cb.completeExceptionally(new TransactionBufferClientException
- .RequestTimeoutException());
- onResponse(peek);
- }
- }, operationTimeoutInMills, TimeUnit.MILLISECONDS);
- op.cmd.retain();
- clientCnx.ctx().writeAndFlush(op.cmd, clientCnx.ctx().voidPromise());
- } else {
- invalidateLookupCache(op);
- op.cb.completeExceptionally(
- new PulsarClientException.LookupException(op.topic + " endTxn channel is not active"));
- onResponse(op);
- }
- } else {
- log.error("endTxn error topic: [{}]", op.topic, throwable);
- invalidateLookupCache(op);
- op.cb.completeExceptionally(
- new PulsarClientException.LookupException(throwable.getMessage()));
- onResponse(op);
+ op.cnx.thenAccept(clientCnx -> {
Review comment:
Why modify this method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org