Closing connections idle longer than 5000 MILLISECONDS

Today I solved the classmate’s bug. Every time I start tomcat, it will print something like this every second

<Closing connections idle longer than 60000 MILLISECONDS>
<Closing expired connections>

This literally means idle connection for 60s. Then I wrote a cos Tencent Cloud upload file. The code I wrote is good. He kept printing this when he wrote, which caused me to print sql. After a while, there was no trace, and it was printed by this. Very annoying!

Many people's solutions are not effective. It is possible that they have not encountered such problems, let alone see the code, how can it be solved?

For our project, using ssm to do, then there is one thing everyone must be familiar with. This is it

@Component

Note, at first glance, there is nothing wrong with it! I! The culprit appeared, it was this comment written outside the class declaration, which often overlooked the problem!

It causes continuous connection, continuous connection! ! !

Well, the problem I encountered is solved, just delete it! After restarting tomcat, there is nothing wrong with it. So some things can’t be written randomly!

Also, you must upload files using COS Tencent Cloud

cosClient.shutdown();

Turn off, so that it will not be connected.

------20190108 Supplementary Note------------

Remember that once you declare COS first, then this class can no longer be used for other purposes, otherwise cosClient must be closed.

Guess you like

Origin blog.csdn.net/qq_41520636/article/details/85268143