if (cnx == null) { final AtomicInteger releaseCount = new AtomicInteger(); pendingMessages.forEach(op -> { releaseCount.addAndGet(op.numMessagesInBatch); try {
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); log.info("{} Disconnected", ctx.channel()); if (!connectionFuture.isDone()) { connectionFuture.completeExceptionally(new PulsarClientException("Connection already closed")); } PulsarClientException e = new PulsarClientException( "Disconnected from server at " + ctx.channel().remoteAddress()); // Fail out all the pending ops pendingRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingLookupRequests.forEach((key, future) -> future.completeExceptionally(e)); waitingLookupRequests.forEach(pair -> pair.getRight().getRight().completeExceptionally(e)); pendingGetLastMessageIdRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingGetTopicsRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingGetSchemaRequests.forEach((key, future) -> future.completeExceptionally(e)); // Notify all attached producers/consumers so they have a chance to reconnect producers.forEach((id, producer) -> producer.connectionClosed(this)); consumers.forEach((id, consumer) -> consumer.connectionClosed(this)); pendingRequests.clear(); pendingLookupRequests.clear(); waitingLookupRequests.clear(); pendingGetLastMessageIdRequests.clear(); pendingGetTopicsRequests.clear(); producers.clear(); consumers.clear(); timeoutTask.cancel(true); }
PulsarClientException ex = new PulsarClientException.AlreadyClosedException( "Producer was already closed"); pendingMessages.forEach(msg -> { msg.callback.sendComplete(ex); msg.cmd.release(); log.info("[{}] [{}] Closed Producer", topic, producerName); setState(State.Closed); pendingMessages.forEach(msg -> { msg.cmd.release(); msg.recycle();
public List<Task> getScheduledTasks() { List<Task> result = new ArrayList<>(); executor.getQueue().forEach(r -> result.add((Task) r)); return result; }
public List<Task> getScheduledTasks() { List<Task> result = new ArrayList<>(); executor.getQueue().forEach(r -> result.add((Task) r)); return result; }
queue.forEach(action::accept);
/** * Conclude the visit to the current repo. * Calls {@link CommitVisitor#finalize} on each CommitVisitor in my collection. */ void endRepoVisit() { /* finalize() the visitors with the repo. */ for (CVPM cvpm : visitors) { try { log.info("-> Finalizing visitor " + cvpm.cv.name()); cvpm.cv.finalize(currentRepo, cvpm.pm); } catch (Exception e) { log.error("Error in " + currentRepo.getPath() + "when finalizing " + cvpm.cv.name() + ", error=" + e.getMessage(), e); } } /* Clean the clonePool. */ assert(clonePool.remainingCapacity() == 0); // No leaked clones. clonePool.forEach(clone -> { clone.repo.getScm().delete(); // Safe to call more than once on the same SCM, if !visitorsChangeRepoState. }); clonePool.clear(); /* No current repo. */ currentRepo = null; }
if (cnx == null) { final AtomicInteger releaseCount = new AtomicInteger(); pendingMessages.forEach(op -> { releaseCount.addAndGet(op.numMessagesInBatch); try {
if (cnx == null) { final AtomicInteger releaseCount = new AtomicInteger(); pendingMessages.forEach(op -> { releaseCount.addAndGet(op.numMessagesInBatch); try {
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); log.info("{} Disconnected", ctx.channel()); if (!connectionFuture.isDone()) { connectionFuture.completeExceptionally(new PulsarClientException("Connection already closed")); } PulsarClientException e = new PulsarClientException( "Disconnected from server at " + ctx.channel().remoteAddress()); // Fail out all the pending ops pendingRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingLookupRequests.forEach((key, future) -> future.completeExceptionally(e)); waitingLookupRequests.forEach(pair -> pair.getRight().getRight().completeExceptionally(e)); pendingGetLastMessageIdRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingGetTopicsRequests.forEach((key, future) -> future.completeExceptionally(e)); pendingGetSchemaRequests.forEach((key, future) -> future.completeExceptionally(e)); // Notify all attached producers/consumers so they have a chance to reconnect producers.forEach((id, producer) -> producer.connectionClosed(this)); consumers.forEach((id, consumer) -> consumer.connectionClosed(this)); pendingRequests.clear(); pendingLookupRequests.clear(); waitingLookupRequests.clear(); pendingGetLastMessageIdRequests.clear(); pendingGetTopicsRequests.clear(); producers.clear(); consumers.clear(); }
PulsarClientException ex = new PulsarClientException.AlreadyClosedException( "Producer was already closed"); pendingMessages.forEach(msg -> { msg.callback.sendComplete(ex); msg.cmd.release(); log.info("[{}] [{}] Closed Producer", topic, producerName); setState(State.Closed); pendingMessages.forEach(msg -> { msg.cmd.release(); msg.recycle();
PulsarClientException ex = new PulsarClientException.AlreadyClosedException( "Producer was already closed"); pendingMessages.forEach(msg -> { msg.callback.sendComplete(ex); msg.cmd.release(); log.info("[{}] [{}] Closed Producer", topic, producerName); setState(State.Closed); pendingMessages.forEach(msg -> { msg.cmd.release(); msg.recycle();