codelipenghui commented on a change in pull request #13939:
URL: https://github.com/apache/pulsar/pull/13939#discussion_r810987177
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedger.java
##########
@@ -292,6 +292,13 @@ ManagedCursor newNonDurableCursor(Position startPosition,
String subscriptionNam
*/
void deleteCursor(String name) throws InterruptedException,
ManagedLedgerException;
+ /**
+ * Remove a ManagedCursor from this ManagedLedger's waitingCursors.
+ *
+ * @param cursor the ManagedCursor
+ */
+ void removeWaitingCursor(ManagedCursor cursor);
Review comment:
Is it better to improve the method `deactivateCursor(ManagedCursor
cursor)` to remove the cursor from the `waitingCursors`? Looks like we have
removed the cursor from the `activeCursors` but does not remove it from the
`waitingCursors`, so that we don't need to introduce a new method for
ManagedLedger.
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/CreateSubscriptionTest.java
##########
@@ -348,4 +352,18 @@ public void createSubscriptionBySpecifyingStringPosition()
throws IOException, P
producer.close();
}
+
+ @Test
+ public void testWaitingCurosrCausedMemoryLeak() throws Exception {
+ String topic = "persistent://my-property/my-ns/my-topic";
+ for (int i=0; i<10; i++) {
Review comment:
```suggestion
for (int i = 0; i < 10; i ++) {
```
--
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]