| 35547 |
amit |
1 |
package com.spice.profitmandi.dao.config;
|
|
|
2 |
|
|
|
3 |
import org.springframework.context.annotation.Bean;
|
|
|
4 |
import org.springframework.context.annotation.Configuration;
|
|
|
5 |
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
6 |
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
7 |
|
|
|
8 |
import java.util.concurrent.Executor;
|
|
|
9 |
|
|
|
10 |
/**
|
|
|
11 |
* Configuration for async processing of Solr updates.
|
|
|
12 |
* Enables non-blocking Solr updates when TagListing changes.
|
|
|
13 |
*/
|
|
|
14 |
@Configuration
|
|
|
15 |
@EnableAsync
|
|
|
16 |
public class AsyncConfig {
|
|
|
17 |
|
|
|
18 |
@Bean(name = "solrUpdateExecutor")
|
|
|
19 |
public Executor solrUpdateExecutor() {
|
|
|
20 |
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
21 |
executor.setCorePoolSize(2);
|
|
|
22 |
executor.setMaxPoolSize(5);
|
|
|
23 |
executor.setQueueCapacity(100);
|
|
|
24 |
executor.setThreadNamePrefix("solr-update-");
|
|
|
25 |
executor.initialize();
|
|
|
26 |
return executor;
|
|
|
27 |
}
|
|
|
28 |
}
|