调整知识库http客户端线程池
This commit is contained in:
parent
ec6597ba35
commit
90b62a9f8f
|
@ -45,10 +45,7 @@ import io.renren.modules.sys.dao.SysDeptDao;
|
|||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.*;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstanceQuery;
|
||||
|
@ -85,6 +82,16 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newWorkStealingPool(cpuNUm * 3);
|
||||
|
||||
/**
|
||||
* 公共http客户端
|
||||
*/
|
||||
private static final OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(100, TimeUnit.MICROSECONDS)
|
||||
.readTimeout(1, TimeUnit.MINUTES)
|
||||
.connectionPool(new ConnectionPool(cpuNUm * 2, 2, TimeUnit.MINUTES))
|
||||
.retryOnConnectionFailure(false)
|
||||
.build();
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
|
||||
|
||||
private static final String selectDeptListKey = "selectDeptList";
|
||||
|
@ -1029,8 +1036,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void KnowledgeBase() {
|
||||
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
|
||||
final int pageSize = 100;
|
||||
final OkHttpClient client = new OkHttpClient();
|
||||
final int pageSize = cpuNUm * 10;
|
||||
Arrays.stream(catalogIds).map(index -> {
|
||||
logger.info("处理:" + index);
|
||||
CopyOnWriteArrayList<CompletableFuture> task = new CopyOnWriteArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue