调整/更换 executor

This commit is contained in:
shikong 2023-10-08 13:36:05 +08:00
parent 3421c2dc69
commit df68ad5c5e
3 changed files with 7 additions and 7 deletions

View File

@ -27,8 +27,8 @@ public class MockingExecutor{
@Bean(EXECUTOR_BEAN_NAME) @Bean(EXECUTOR_BEAN_NAME)
public ThreadPoolTaskExecutor sipTaskExecutor() { public ThreadPoolTaskExecutor sipTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(CPU_NUM); executor.setCorePoolSize(CPU_NUM * 2);
executor.setMaxPoolSize(MAX_POOL_SIZE); executor.setMaxPoolSize(100);
executor.setQueueCapacity(10000); executor.setQueueCapacity(10000);
executor.setKeepAliveSeconds(30); executor.setKeepAliveSeconds(30);
executor.setThreadNamePrefix(THREAD_NAME_PREFIX); executor.setThreadNamePrefix(THREAD_NAME_PREFIX);

View File

@ -1,9 +1,9 @@
package cn.skcks.docking.gb28181.mocking.core.sip.listener; package cn.skcks.docking.gb28181.mocking.core.sip.listener;
import cn.skcks.docking.gb28181.common.json.ResponseStatus; import cn.skcks.docking.gb28181.common.json.ResponseStatus;
import cn.skcks.docking.gb28181.core.sip.executor.DefaultSipExecutor;
import cn.skcks.docking.gb28181.core.sip.listener.SipListener; import cn.skcks.docking.gb28181.core.sip.listener.SipListener;
import cn.skcks.docking.gb28181.core.sip.message.processor.MessageProcessor; import cn.skcks.docking.gb28181.core.sip.message.processor.MessageProcessor;
import cn.skcks.docking.gb28181.mocking.core.sip.executor.MockingExecutor;
import cn.skcks.docking.gb28181.mocking.core.sip.response.SipResponseBuilder; import cn.skcks.docking.gb28181.mocking.core.sip.response.SipResponseBuilder;
import cn.skcks.docking.gb28181.mocking.core.sip.sender.SipSender; import cn.skcks.docking.gb28181.mocking.core.sip.sender.SipSender;
import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPRequest;
@ -41,7 +41,7 @@ public class SipListenerImpl implements SipListener {
@Override @Override
@Async(DefaultSipExecutor.EXECUTOR_BEAN_NAME) @Async(MockingExecutor.EXECUTOR_BEAN_NAME)
public void processRequest(RequestEvent requestEvent) { public void processRequest(RequestEvent requestEvent) {
String method = requestEvent.getRequest().getMethod(); String method = requestEvent.getRequest().getMethod();
log.debug("传入请求 method => {}", method); log.debug("传入请求 method => {}", method);
@ -57,7 +57,7 @@ public class SipListenerImpl implements SipListener {
} }
@Override @Override
@Async(DefaultSipExecutor.EXECUTOR_BEAN_NAME) @Async(MockingExecutor.EXECUTOR_BEAN_NAME)
public void processResponse(ResponseEvent responseEvent) { public void processResponse(ResponseEvent responseEvent) {
Response response = responseEvent.getResponse(); Response response = responseEvent.getResponse();
int status = response.getStatusCode(); int status = response.getStatusCode();

View File

@ -1,7 +1,7 @@
package cn.skcks.docking.gb28181.mocking.core.sip.message.subscribe; package cn.skcks.docking.gb28181.mocking.core.sip.message.subscribe;
import cn.skcks.docking.gb28181.core.sip.executor.DefaultSipExecutor;
import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe; import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe;
import cn.skcks.docking.gb28181.mocking.core.sip.executor.MockingExecutor;
import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse; import gov.nist.javax.sip.message.SIPResponse;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
@ -19,7 +19,7 @@ import java.util.concurrent.Executor;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class SipSubscribe { public class SipSubscribe {
@Qualifier(DefaultSipExecutor.EXECUTOR_BEAN_NAME) @Qualifier(MockingExecutor.EXECUTOR_BEAN_NAME)
private final Executor executor; private final Executor executor;
private GenericSubscribe<SIPResponse> registerSubscribe; private GenericSubscribe<SIPResponse> registerSubscribe;
private GenericSubscribe<SIPRequest> ackSubscribe; private GenericSubscribe<SIPRequest> ackSubscribe;