Fix worker cannot shutdown due to resource close failed or heart beat check failed (#10979)
* Use try-with-resource to close resource, and add heart error threshold to avoid worker cannot close due to heart beat check failed
* Move heartbeat error threshold to applicaiton.yml
# Master heart beat task error threshold, if the continuous error count exceed this count, the master will close.
heartbeat-error-threshold:5
# master commit task retry times
task-commit-retry-times:5
# master commit task interval
@ -154,6 +156,8 @@ worker:
exec-threads:10
# worker heartbeat interval
heartbeat-interval:10s
# Worker heart beat task error threshold, if the continuous error count exceed this count, the worker will close.
heartbeat-error-threshold:5
# worker host weight to dispatch tasks, default value 100
host-weight:100
# tenant corresponds to the user of the system, which is used by the worker to submit the job. If system does not have this user, it will be automatically created after the parameter worker.tenant.auto.create is true.
# Worker heart beat task error threshold, if the continuous error count exceed this count, the worker will close.
heartbeat-error-threshold:5
# worker host weight to dispatch tasks, default value 100
host-weight:100
# tenant corresponds to the user of the system, which is used by the worker to submit the job. If system does not have this user, it will be automatically created after the parameter worker.tenant.auto.create is true.