【问题标题】:Why is spring boot using threads from different packages to handle requests?为什么 spring boot 使用来自不同包的线程来处理请求?
【发布时间】:2015-08-25 14:12:13
【问题描述】:

所以,我只是按照tutorial 为自己设置了一些基本身份验证。

在查看日志时,我有一个关于发生了什么的问题。这是日志sn-p:

2015-08-24 23:08:22.690  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:08:22.691  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:08:22.693  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:09:50.033  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]
2015-08-24 23:09:50.035  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]
2015-08-24 23:09:50.037  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]

为了生成这些日志,我所做的只是登录/注销两次。我的问题是,为什么第二次尝试使用不同类型的线程?我第一次登录时使用nio 线程,第二次使用io 线程。关于为什么会发生这种情况或如何配置它的任何信息都会很棒。

【问题讨论】:

  • 这是同一个线程。但是这个名字只是有一定的长度限制......

标签: java spring spring-mvc spring-security spring-boot


【解决方案1】:

Spring Boot 的默认日志模式允许线程名称使用 15 个字符。当名称太长时,它会通过从开头删除字符来减少名称的长度。 nio-8080-exec-10 的长度为 16 个字符,因此删除第一个字符,留下 io-8080-exec-10

【讨论】:

    猜你喜欢
    • 2021-06-07
    • 1970-01-01
    • 2015-07-22
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 1970-01-01
    • 2018-02-23
    相关资源
    最近更新 更多