mattisonchao commented on code in PR #21463:
URL: https://github.com/apache/pulsar/pull/21463#discussion_r1376119785


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2189,70 +2188,53 @@ public CompletableFuture<Void> 
checkTopicNsOwnership(final String topic) {
                 });
     }
 
-    public CompletableFuture<Integer> unloadServiceUnit(NamespaceBundle 
serviceUnit,
-            boolean closeWithoutWaitingClientDisconnect, long timeout, 
TimeUnit unit) {
-        CompletableFuture<Integer> future = unloadServiceUnit(serviceUnit, 
closeWithoutWaitingClientDisconnect);
-        ScheduledFuture<?> taskTimeout = executor().schedule(() -> {
-            if (!future.isDone()) {
-                log.warn("Unloading of {} has timed out", serviceUnit);
-                // Complete the future with no error
-                future.complete(0);
-            }
-        }, timeout, unit);
-
-        future.whenComplete((r, ex) -> taskTimeout.cancel(true));
-        return future;
-    }
-
     /**
-     * Unload all the topic served by the broker service under the given 
service unit.
+     * Unload and close topics by namespace-bundle. It will close all topics 
in the namespace bundle.
      *
-     * @param serviceUnit
-     * @param closeWithoutWaitingClientDisconnect don't wait for clients to 
disconnect
-     *                                           and forcefully close 
managed-ledger
-     * @return
+     * @param namespaceBundle                           Namespace bundle
+     * @param closeWithoutWaitingClientDisconnect       Whether wait client 
disconnection while closing topic
+     * @param timeout                                   Timeout time
+     * @param unit                                      Timeout time unit
+     * @return Return the future of namespace bundle unloading and how many 
topics has been unloaded.
+     * Note:
+     *      If
+     * @throws NullPointerException Throw NPE when namespace-bundle or time 
unit is null.
      */
-    private CompletableFuture<Integer> unloadServiceUnit(NamespaceBundle 
serviceUnit,
-                                                         boolean 
closeWithoutWaitingClientDisconnect) {
-        List<CompletableFuture<Void>> closeFutures = new ArrayList<>();
+    public CompletableFuture<Integer> unloadServiceUnit(NamespaceBundle 
namespaceBundle,
+            boolean closeWithoutWaitingClientDisconnect, long timeout, 
TimeUnit unit) {
+        requireNonNull(namespaceBundle);

Review Comment:
   Just a simple NPE check for public API.



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to