eolivelli commented on a change in pull request #9194:
URL: https://github.com/apache/pulsar/pull/9194#discussion_r556284711
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/intercept/ManagedLedgerInterceptorImpl.java
##########
@@ -81,10 +81,11 @@ public void onManagedLedgerPropertiesInitialize(Map<String,
String> propertiesMa
@Override
public void onManagedLedgerLastLedgerInitialize(String name, LedgerHandle
lh) {
+ LedgerEntries ledgerEntries = null;
try {
for (BrokerEntryMetadataInterceptor interceptor :
brokerEntryMetadataInterceptors) {
if (interceptor instanceof AppendIndexMetadataInterceptor &&
lh.getLastAddConfirmed() >= 0) {
- LedgerEntries ledgerEntries =
+ ledgerEntries =
Review comment:
You can use a try-with-resources block and close the object as soon as
we do not it anymore
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/intercept/ManagedLedgerInterceptorImpl.java
##########
@@ -81,10 +81,11 @@ public void onManagedLedgerPropertiesInitialize(Map<String,
String> propertiesMa
@Override
public void onManagedLedgerLastLedgerInitialize(String name, LedgerHandle
lh) {
+ LedgerEntries ledgerEntries = null;
try {
for (BrokerEntryMetadataInterceptor interceptor :
brokerEntryMetadataInterceptors) {
if (interceptor instanceof AppendIndexMetadataInterceptor &&
lh.getLastAddConfirmed() >= 0) {
- LedgerEntries ledgerEntries =
+ ledgerEntries =
Review comment:
What happens if we get to here multiple times?
There is no invariant that enforces the presence of only one
AppendIndexMetadataInterceptor
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]