Skip to content

Commit

Permalink
optimize code and update some default values
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhom1314 committed Dec 17, 2023
1 parent 9965f8f commit 5969e5e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class DtpExecutorProps extends TpExecutorProps {

/**
* Executor type, used in create phase, see {@link org.dromara.dynamictp.core.support.ExecutorType}
* Executor type, used in create phase, see {@link org.dromara.dynamictp.core.executor.ExecutorType}
*/
private String executorType;

Expand Down Expand Up @@ -80,14 +80,14 @@ public class DtpExecutorProps extends TpExecutorProps {
* Whether to wait for scheduled tasks to complete on shutdown,
* not interrupting running tasks and executing all tasks in the queue.
*/
private boolean waitForTasksToCompleteOnShutdown = false;
private boolean waitForTasksToCompleteOnShutdown = true;

/**
* The maximum number of seconds that this executor is supposed to block
* on shutdown in order to wait for remaining tasks to complete their execution
* before the rest of the container continues to shut down.
*/
private int awaitTerminationSeconds = 0;
private int awaitTerminationSeconds = 3;

/**
* If pre start all core threads.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,10 @@ private DtpProperties() { }
*/
private boolean enabledBanner = true;

/**
* Config file type, for zookeeper and etcd.
*/
private String configType;

/**
* If enabled metrics collect.
*/
private boolean enabledCollect = false;
private boolean enabledCollect = true;

/**
* Metrics collector types, default is logging.
Expand All @@ -67,6 +62,11 @@ private DtpProperties() { }
*/
private String logPath;

/**
* Config file type, for zookeeper and etcd.
*/
private String configType;

/**
* Monitor interval, time unit(s)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class ThreadPoolBuilder {
/**
* Max free memory for MemorySafeLBQ, unit M
*/
private int maxFreeMemory = 256;
private int maxFreeMemory = 16;

/**
* RejectedExecutionHandler, see {@link RejectedTypeEnum}
Expand Down Expand Up @@ -439,6 +439,16 @@ public OrderedDtpExecutor buildOrdered() {
return (OrderedDtpExecutor) buildDtpExecutor(this);
}

/**
* Build eager thread pool executor.
*
* @return the newly created EagerDtpExecutor instance
*/
public EagerDtpExecutor buildEager() {
eager = true;
return (EagerDtpExecutor) buildDtpExecutor(this);
}

/**
* Build thread pool executor and wrapper with ttl
*
Expand Down

0 comments on commit 5969e5e

Please sign in to comment.