diff --git a/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/logminer/processor/AbstractLogMinerEventProcessor.java b/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/logminer/processor/AbstractLogMinerEventProcessor.java index ef42ed5b8..67d16fb49 100644 --- a/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/logminer/processor/AbstractLogMinerEventProcessor.java +++ b/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/logminer/processor/AbstractLogMinerEventProcessor.java @@ -1426,9 +1426,11 @@ public void abandonTransactions(Duration retention) throws InterruptedException if (entry.getValue().getStartScn().compareTo(thresholdScn) <= 0) { if (first) { LOGGER.warn("All transactions with SCN <= {} will be abandoned.", thresholdScn); - if(LOGGER.isDebugEnabled()) { - LOGGER.debug("List of transactions in the cache before transactions being abandoned: [{}]", - getTransactionCache().keySet().stream().collect(Collectors.joining(","))); + if (LOGGER.isDebugEnabled()) { + try (Stream s = getTransactionCache().keySet().stream()) { + LOGGER.debug("List of transactions in the cache before transactions being abandoned: [{}]", + s.collect(Collectors.joining(","))); + } } first = false; } @@ -1449,9 +1451,11 @@ public void abandonTransactions(Duration retention) throws InterruptedException ((CloseableIterator>) iterator).close(); } } - if(LOGGER.isDebugEnabled()) { - LOGGER.debug("List of transactions in the cache after transactions being abandoned: [{}]", - getTransactionCache().keySet().stream().collect(Collectors.joining(","))); + if (LOGGER.isDebugEnabled()) { + try (Stream s = getTransactionCache().keySet().stream()) { + LOGGER.debug("List of transactions in the cache after transactions being abandoned: [{}]", + s.collect(Collectors.joining(","))); + } } // Update the oldest scn metric are transaction abandonment