Renjith Panikar wrote:One more question.
What about using Spring's 'ThreadPoolTaskExecutor', there we can handle the Queue size?
b. JDBC template is thread safe once instantiated.
You are right. That is one reason i kept the JdbcTemplate creation outside of all threads. But seems like the point given by Jayesh contradicts with this.
Note that the threads will not be able to share a transaction. Each thread will have tok open it's own connection to db and each connection will have its own transaction
@Jayesh By opening so much connection, is it possible that it can consume most of the connections in the DB2 connection pool?
@Saifuddin What's your thought? if we use a single JdbcTemplate, i think it will take the same amount of time as that of executing single batch at a time.
Instances of the JdbcTemplate class are threadsafe once configured. This is important because it means that you can configure a single instance of a JdbcTemplate and then safely inject this shared reference into multiple DAOs (or repositories). The JdbcTemplate is stateful, in that it maintains a reference to a DataSource, but this state is not conversational state.
Prerana Verma wrote:@Saifuddin Merchant : By Creating anonymous class for Runnable or Thread.
Prerana Verma wrote:Thanku for replying...
It’s just a java beginner’s query. I was trying to implement that but didn’t find any way (Found one by using anonymous class).
Just wanted to know if there is any other way of doing this.
Dian D Chen wrote:Thank you so much! It works now~
BTW, when I read the tutorial from Apache Maven, it mentioned about setting M2 sys variable. Is that M2 same as this ".m2"?