codelipenghui commented on a change in pull request #14379:
URL: https://github.com/apache/pulsar/pull/14379#discussion_r812015161
##########
File path:
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarRecordCursor.java
##########
@@ -235,113 +237,117 @@ public void
setPulsarSqlSchemaInfoProvider(PulsarSqlSchemaInfoProvider schemaInf
}
@VisibleForTesting
- class DeserializeEntries implements Runnable {
+ class DeserializeEntries extends Thread {
protected boolean isRunning = false;
- private final Thread thread;
+ private final CompletableFuture<Void> closeHandle;
public DeserializeEntries() {
- this.thread = new Thread(this, "derserialize-thread-split-" +
pulsarSplit.getSplitId());
+ super("deserialize-thread-split-" + pulsarSplit.getSplitId());
+ this.closeHandle = new CompletableFuture<>();
}
- public void interrupt() {
+ public CompletableFuture<Void> close() {
isRunning = false;
- thread.interrupt();
- }
-
- public void start() {
- this.thread.start();
+ super.interrupt();
Review comment:
Do we need to avoid the `DeserializeEntries` can being closed multiple
times? Otherwise, I think we will get an exception here.
--
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]