Skip to content

Commit

Permalink
Update Tasks.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RockyLOMO committed Aug 21, 2024
1 parent 137c13b commit d27b6fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rxlib/src/main/java/org/rx/core/Tasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public final class Tasks {
static int poolCount;

static {
ObjectChangeTracker.DEFAULT.register(Tasks.class);
onChanged(new ObjectChangedEvent(RxConfig.INSTANCE, Collections.emptyMap()));
createPool(new ObjectChangedEvent(RxConfig.INSTANCE, Collections.emptyMap()));

executor = new AbstractExecutorService() {
@Getter
Expand Down Expand Up @@ -103,10 +102,12 @@ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedE
log.warn("setAsyncPool {}", e, ie);
}
}

timer.setTimeout(() -> ObjectChangeTracker.DEFAULT.register(Tasks.class), 30000);
}

@Subscribe(topicClass = RxConfig.class)
static synchronized void onChanged(ObjectChangedEvent event) {
static synchronized void createPool(ObjectChangedEvent event) {
int newCount = RxConfig.INSTANCE.threadPool.replicas;
if (newCount == poolCount) {
return;
Expand Down

0 comments on commit d27b6fe

Please sign in to comment.