Skip to content

Commit

Permalink
[AMORO-2336] Set the renew blocker thread to be a daemon thread (#2337)
Browse files Browse the repository at this point in the history
renew blocker thread should be daemon
  • Loading branch information
wangtaohz committed Nov 20, 2023
1 parent 596574a commit 2de006c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.netease.arctic.ams.api.NoSuchObjectException;
import com.netease.arctic.table.TableIdentifier;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -31,6 +32,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -81,7 +83,12 @@ private static ScheduledExecutorService getExecutorService() {
if (EXECUTOR == null) {
synchronized (RenewableBlocker.class) {
if (EXECUTOR == null) {
EXECUTOR = Executors.newSingleThreadScheduledExecutor();
ThreadFactory threadFactory =
new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("Renew Blocker Thread %d")
.build();
EXECUTOR = Executors.newSingleThreadScheduledExecutor(threadFactory);
}
}
}
Expand Down

0 comments on commit 2de006c

Please sign in to comment.