Reputation: 75
I have thread that use mysql connection. That thread will be multiply so I will have multi thread. This is summary of my thread.
public class t extends Thread{
...
run() {
// i will do database update here
}
...
}
I will have about 10.000 records and this records will be processed by 5 threads. So if update process finished, the thread will be re-used. I have 3 options for my problem :
Which one is faster?
Upvotes: 0
Views: 570
Reputation: 9394
I think that each thread having own JDBC connection is best from performance reasons, because there is no synchronization overhead.
Upvotes: 1
Reputation: 32535
I would go for using some ORM/JPA implementation like Hibernate and/or use some kind of connections pool for automatic connection management.
Upvotes: 0