I run java program in debug mode using visualvm. I know my methods in the program are called from Main method but I have no idea why there are other threads. Is there a way I can reduce those threds?
Asked
Active
Viewed 38 times
-1
-
and what, save 1 ms ? – Scary Wombat Jul 05 '16 at 02:57
-
Do you think that maybe GC is in another thread? – Scary Wombat Jul 05 '16 at 02:58
-
it's not to save 1ms. I want to know why there are 5 thread apart from my main method. – goutthee Jul 05 '16 at 03:15
-
You are using jdbc and java.util.logging. So you can just recognize these threads as backgound threads working with database and loggins. – chenatu Jul 05 '16 at 03:35
1 Answers
0
As suggested by those method names, they are threads started by MS SQL Server JDBC Connector for timeout checking(your sql request may went lost and without timeout checks, you could be blocked in a SQL request forever). They are started for your goodness and you should not try to stop/reduce them.

glee8e
- 6,180
- 4
- 31
- 51
-
thank u, I check the code. Yes there are methods I called from main method. The methods are called to get connection with database. Since there are such 4 methods, i found 4 extra thread. I used connection pool in main method then pass that connection as one of parameters for those 4 methods. Is there any better way than passing the connection through parameters of methods. – goutthee Jul 05 '16 at 03:52
-
I suggest you open a seperate question for that since that's really out of the scope of this one. I'm not very experienced in the field of JDBC. – glee8e Jul 05 '16 at 04:42