[hotfix] simplify code
### Motivation
Simplify code of `ManagedLedger.getManagedLedgerInfo()`
### Modifications
unify the method of generating `ManagedLedgerInfo`
@@ -3413,20 +3413,7 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
}
private ManagedLedgerInfo getManagedLedgerInfo() {
- ManagedLedgerInfo.Builder mlInfo = ManagedLedgerInfo.newBuilder().addAllLedgerInfo(ledgers.values());
- if (state == State.Terminated) {
- mlInfo.setTerminatedPosition(NestedPositionInfo.newBuilder().setLedgerId(lastConfirmedEntry.getLedgerId())
- .setEntryId(lastConfirmedEntry.getEntryId()));
- }
- if (managedLedgerInterceptor != null) {
- managedLedgerInterceptor.onUpdateManagedLedgerInfo(propertiesMap);
- }
- for (Map.Entry<String, String> property : propertiesMap.entrySet()) {
- mlInfo.addProperties(MLDataFormats.KeyValue.newBuilder()
- .setKey(property.getKey()).setValue(property.getValue()));
- }
-
- return mlInfo.build();
+ return buildManagedLedgerInfo(ledgers);
}
private ManagedLedgerInfo buildManagedLedgerInfo(Map<Long, LedgerInfo> ledgers) {
