Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is spring boot using threads from different packages to handle requests?

So, I just followed this tutorial to get myself setup with some basic authentication.

In looking at the logs, I had a question about whats going on. Here is the log snippet:

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}]

To produce these logs all I did was sign in/out twice. My question is, why is it that the second attempt using a different type of thread? The first time I logged in it used an nio thread, and the second time it used an io thread. Any info as to why this happened or how to configure it would be great.

like image 339
Carlos Bribiescas Avatar asked Jan 08 '23 17:01

Carlos Bribiescas


1 Answers

Spring Boot's default log pattern allows 15 characters for a thread's name. When the name is too long, it reduces the name's length by removing characters from the beginning. nio-8080-exec-10 is 16 characters long so the first character is removed, leaving io-8080-exec-10.

like image 137
Andy Wilkinson Avatar answered Jan 15 '23 15:01

Andy Wilkinson