hailin0 commented on code in PR #2820:
URL: 
https://github.com/apache/incubator-seatunnel/pull/2820#discussion_r978344072


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +130,20 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            executor = new ScheduledThreadPoolExecutor(1, runnable -> {
+                Thread thread = new Thread(runnable);
+                thread.setDaemon(true);
+                thread.setName("pulsar-split-discovery-executor");
+                return thread;
+            });
+            executor.schedule(this::discoverySplits, 
partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);

Review Comment:
   Submits a one-shot task? 
   
   ```java
   
   executor.scheduleAtFixedRate(new Runnable() {
                       @Override
                       public void run() {
                           try {
                               this.discoverySplits();
                           } catch (Throwable e) {
                               log.error(..., e);
                           }
                       }
                   }, 0, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);
   ```



-- 
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]

Reply via email to