chamikaramj commented on code in PR #41504:
URL: https://github.com/apache/beam/pull/41504#discussion_r4736702042
##########
sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/read/UnboundedSolaceReader.java:
##########
@@ -184,6 +189,38 @@ public boolean advance() {
@Override
public void close() {
+ closed.set(true);
+ boolean hasPending;
+ synchronized (lock) {
+ hasPending = !pendingCheckpoints.isEmpty();
Review Comment:
Please address this.
##########
sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/read/UnboundedSolaceReader.java:
##########
@@ -197,15 +234,44 @@ public void close() {
}
}
+ private void abandonPendingCheckpointsOnCloseTimeout() {
+ List<PendingCheckpoint> abandoned;
+ synchronized (lock) {
+ abandoned = new ArrayList<>(pendingCheckpoints.values());
+ pendingCheckpoints.clear();
+ }
+ if (!abandoned.isEmpty()) {
+ int totalMessages = 0;
+ for (PendingCheckpoint cp : abandoned) {
+ totalMessages += cp.messages.size();
+ }
+ LOG.info(
+ "SolaceIO.Read: Reader {} closes with {} checkpoint(s) ({}
message(s)) not finalized"
+ + " within ackDeadline {}.",
+ readerUuid,
+ abandoned.size(),
+ totalMessages,
+ ackDeadline);
+ }
+ }
+
void finalizeCheckpoint(long checkpointId) {
+ if (resourcesClosed.get() || ackExecutor.isShutdown()) {
+ return;
+ }
+ // Keep the cached session alive while acknowledging pending checkpoints.
+ sessionServiceCache.getIfPresent(readerUuid);
+
List<BytesXMLMessage> messagesToAck = new ArrayList<>();
+ boolean shouldCloseAfterAck;
synchronized (lock) {
SortedMap<Long, PendingCheckpoint> toAck =
pendingCheckpoints.headMap(checkpointId, true);
for (PendingCheckpoint cp : toAck.values()) {
Review Comment:
Please address.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]