Spring执行器关闭终结点无法停止java进程

Spring执行器关闭终结点无法停止java进程,java,spring,spring-boot,jhipster,spring-boot-actuator,Java,Spring,Spring Boot,Jhipster,Spring Boot Actuator,我想关闭带有执行器端点的spring boot应用程序(spring boot v2)。我已经成功地使用弹簧执行器启用了关机端点(请参见application.yml)。我还可以调用端点,spring会关闭应用程序上下文(请参阅logs和curl命令) 但不知何故,java进程并没有被扼杀。我还尝试将我的应用程序打包到docker容器中,以确保它不是java的本地安装问题。但没有成功——java进程仍在运行 该应用程序在开发模式下启动,使用H2数据库和Spring Data Jest进行elas

我想关闭带有执行器端点的spring boot应用程序(spring boot v2)。我已经成功地使用弹簧执行器启用了关机端点(请参见application.yml)。我还可以调用端点,spring会关闭应用程序上下文(请参阅logs和curl命令)

但不知何故,java进程并没有被扼杀。我还尝试将我的应用程序打包到docker容器中,以确保它不是java的本地安装问题。但没有成功——java进程仍在运行

该应用程序在开发模式下启动,使用H2数据库和Spring Data Jest进行elasticsearch

application.yml

management: security: roles: ADMIN endpoints: web: base-path: /management exposure: include: ["configprops", "env", "health", "info", "threaddump", "logfile", "shutdown" ] endpoint: health: show-details: when_authorized shutdown: enabled: true info: git: mode: full health: mail: enabled: false # When using the MailService, configure an SMTP server and set this to true metrics: enabled: false # http://micrometer.io/ is disabled by default, as we use http://metrics.dropwizard.io/ instead spring: autoconfigure: exclude: org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration,org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration application: name: AnyWEB profiles: # The commented value for `active` can be replaced with valid Spring profiles to load. # Otherwise, it will be filled in by gradle when building the WAR file # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` active: #spring.profiles.active# jpa: open-in-view: false hibernate: ddl-auto: none naming: physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy messages: basename: i18n/messages mvc: favicon: enabled: false thymeleaf: mode: HTML server: servlet: session: cookie: http-only: true info: # Comma separated list of profiles that will trigger the ribbon to show display-ribbon-on-profiles: "dev" jhipster: async: core-pool-size: 2 max-pool-size: 50 queue-capacity: 10000 # By default CORS is disabled. Uncomment to enable. #cors: #allowed-origins: "*" #allowed-methods: "*" #allowed-headers: "*" #exposed-headers: "Authorization,Link,X-Total-Count" #allow-credentials: true #max-age: 1800 mail: from: AnyWEB@localhost swagger: default-include-pattern: /api/.* title: AnyWEB API description: AnyWEB API documentation version: 0.0.1 terms-of-service-url: contact-name: contact-url: contact-email: license: license-url: logging: file: build/AnyWEB.log 管理层: 安全: 角色:管理员 端点: 网状物: 基本路径管理 暴露: 包括:[“configprops”、“环境”、“运行状况”、“信息”、“线程转储”、“日志文件”、“关机”] 终点: 健康: 显示详细信息:授权时 关闭: 已启用:true 信息: 吉特: 模式:全部 健康: 邮寄: 启用:false#使用邮件服务时,配置SMTP服务器并将其设置为true 韵律学: 已启用:false#http://micrometer.io/ 默认情况下是禁用的,正如我们使用http://metrics.dropwizard.io/ 相反 春天: 自动配置: 排除:org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration,org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration 应用程序: 名称:AnyWEB 简介: #“active”的注释值可以替换为要加载的有效弹簧外形。 #否则,它将由gradle在构建WAR文件时填写 #无论哪种方式,它都可以被命令行中传递的“--spring.profiles.active”值或“JAVA\u OPTS”中设置的“--dsspring.profiles.active”覆盖` 活动:#spring.profiles.active# jpa: 在视图中打开:false 冬眠: ddl自动:无 命名: 物理策略:org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy 隐式策略:org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy 信息: 基本名称:i18n/messages mvc: 法维康: 已启用:false 百里香: 模式:HTML 服务器: servlet: 会议: 曲奇: 仅http:true 信息: #将触发功能区显示的以逗号分隔的配置文件列表 在配置文件上显示功能区:“开发人员” 杰普斯特: 异步: 核心池大小:2 最大池容量:50 排队容量:10000 #默认情况下,CORS处于禁用状态。取消注释以启用。 #cors: #允许的来源:“*” #允许的方法:“*” #允许的标题:“*” #公开的标题:“授权、链接、X总数” #允许凭据:true #最高年龄:1800 邮寄: 发件人:AnyWEB@localhost 昂首阔步: 默认包含模式:/api/* 标题:AnyWebAPI 描述:AnyWebAPI文档 版本:0.0.1 服务条款网址: 联系人姓名: 联系地址: 联络电邮: 许可证: 许可证url: 登录中: 文件:build/AnyWEB.log 旋涡关闭端点

curl --header "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTUzOTQzNTk0OX0.tlu88esl-PYzdZvdEnlaJJB2Niy4p2AOtHqL5O7tr1C2LDottIZJtZGAi2WLTW9VYKUScY-eDi3P7TxhndS6CA" -X POST 192.168.99.100:8080/management/shutdown % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 35 0 35 0 0 66 0 --:--:-- --:--:-- --:--:-- 66{"message":"Shutting down, bye..."} curl--header“Authorization:Bearer eyJhbGciOiJIUzUxMiJ9.eyjzdwijoizg1biisimf1ggioijst0xfx0feturolfjftevvvfuiisimv4cci6mtuzotqntzntk0ox0.tlu88esl-pyzdzvdenlajb2niy4p2othql5o7tr1dottizgai2wltw9vykuscy-eDi3P7TxhndS6CA”-POST 192.168.99.100:8080/管理/关闭 %总接收百分比%x平均速度时间电流 数据加载上载总左速度 100 35 0 35 0 0 66 0--:-:-:-:-:-:-:-:-:-:-:-:---66{“消息”:“关机,再见…” 关闭时记录日志:

这里是调用执行器关闭端点后的完整线程转储

Full thread dump "XNIO-1 Accept@7046" daemon prio=5 tid=0x17 nid=NA runnable java.lang.Thread.State: RUNNABLE at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1) at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296) at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278) at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86) - locked (a sun.nio.ch.WindowsSelectorImpl) - locked (a java.util.Collections$UnmodifiableSet) - locked (a sun.nio.ch.Util$2) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101) at org.xnio.nio.WorkerThread.run(WorkerThread.java:511) "XNIO-1 I/O-1@7045" daemon prio=5 tid=0x16 nid=NA runnable java.lang.Thread.State: RUNNABLE at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1) at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296) at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278) at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86) - locked (a sun.nio.ch.WindowsSelectorImpl) - locked (a java.util.Collections$UnmodifiableSet) - locked (a sun.nio.ch.Util$2) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101) at org.xnio.nio.WorkerThread.run(WorkerThread.java:511) "pool-4-thread-1@19750" prio=5 tid=0x3b nid=NA waiting java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Unsafe.java:-1) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) "Abandoned connection cleanup thread@6449" daemon prio=5 tid=0x15 nid=NA waiting java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Unsafe.java:-1) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) "MVStore background writer nio:C:/Users/Simon/git/lisaweb/build/h2db/db/lisaweb.mv.db@7366" daemon prio=5 tid=0x19 nid=NA waiting java.lang.Thread.State: WAITING at java.lang.Object.wait(Object.java:-1) at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2708) "Finalizer@19938" daemon prio=8 tid=0x3 nid=NA waiting java.lang.Thread.State: WAITING at java.lang.Object.wait(Object.java:-1) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209) "Reference Handler@19939" daemon prio=10 tid=0x2 nid=NA waiting java.lang.Thread.State: WAITING at java.lang.Object.wait(Object.java:-1) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference.tryHandlePending(Reference.java:191) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153) "DestroyJavaVM@19830" prio=5 tid=0x42 nid=NA runnable java.lang.Thread.State: RUNNABLE "Attach Listener@19936" daemon prio=5 tid=0x5 nid=NA runnable java.lang.Thread.State: RUNNABLE "Signal Dispatcher@19937" daemon prio=9 tid=0x4 nid=NA runnable java.lang.Thread.State: RUNNABLE 全线程转储 “XNIO-1Accept@7046“守护进程prio=5 tid=0x17 nid=NA可运行 java.lang.Thread.State:可运行 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1) 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296) 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278) 位于sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159) 在sun.nio.ch.SelectorImpl.lock和doselect上(SelectorImpl.java:86) -锁定(sun.nio.ch.WindowsSelectorImpl) -锁定(java.util.Collections$UnmodifiableSet) -锁定(sun.nio.ch.Util$2) 在sun.nio.ch.SelectorImpl.select上(SelectorImpl.java:97) 在sun.nio.ch.SelectorImpl.select上(SelectorImpl.java:101) 位于org.xnio.nio.WorkerThread.run(WorkerThread.java:511) “XNIO-1输入/输出-1@7045“守护进程prio=5 tid=0x16 nid=NA可运行 java.lang.Thread.State:可运行 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1) 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296) 位于sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278) 位于sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159) 在sun.nio.ch.SelectorImpl.lock和doselect上(SelectorImpl.java:86) -锁定(sun.nio.ch.WindowsSelectorImpl) -锁定(java.util文件)