test
youys 3 years ago
parent 3487d0739f
commit 7b08bb77ba

@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
public class CustomExceptionHandler { public class CustomExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomExceptionHandler.class); private static final Logger LOGGER = LoggerFactory.getLogger(CustomExceptionHandler.class);
/** /**
* Exception * Exception
* *

@ -11,12 +11,14 @@ public class DynamicDataSourceContextHolder {
* *
*/ */
private static final ThreadLocal<String> DATASOURCE_CONTEXT_KEY_HOLDER = new ThreadLocal<>(); private static final ThreadLocal<String> DATASOURCE_CONTEXT_KEY_HOLDER = new ThreadLocal<>();
/** /**
* / * /
*/ */
public static void setContextKey(String key) { public static void setContextKey(String key) {
DATASOURCE_CONTEXT_KEY_HOLDER.set(key); DATASOURCE_CONTEXT_KEY_HOLDER.set(key);
} }
/** /**
* *
*/ */

@ -22,7 +22,7 @@ public class ThreadPoolConfig {
@Bean("sonarQueryResultPool") @Bean("sonarQueryResultPool")
public ExecutorService queryResultPool() { public ExecutorService queryResultPool() {
ThreadFactory sonarQueryResultPool = new CustomizableThreadFactory("sonarScanner-pool-"); ThreadFactory sonarQueryResultPool = new CustomizableThreadFactory("sonarQueryResult-pool-");
return new ThreadPoolExecutor(5, 10, 60, return new ThreadPoolExecutor(5, 10, 60,
TimeUnit.SECONDS, new ArrayBlockingQueue<>(10000), TimeUnit.SECONDS, new ArrayBlockingQueue<>(10000),
sonarQueryResultPool, sonarQueryResultPool,

@ -45,10 +45,6 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
supportedMediaTypes.add(MediaType.TEXT_XML); supportedMediaTypes.add(MediaType.TEXT_XML);
fastJsonHttpMessageConverter.setSupportedMediaTypes(supportedMediaTypes); fastJsonHttpMessageConverter.setSupportedMediaTypes(supportedMediaTypes);
// FastJsonConfig fastJsonConfig = new FastJsonConfig();
// fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteMapNullValue);
//
// fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
converters.add(0,fastJsonHttpMessageConverter); converters.add(0,fastJsonHttpMessageConverter);
} }
} }

@ -1,9 +1,7 @@
package net.educoder.ecsonar.task; package net.educoder.ecsonar.task;
import net.educoder.ecsonar.model.api.Person;
import net.educoder.ecsonar.model.api.SonarRequest; import net.educoder.ecsonar.model.api.SonarRequest;
import net.educoder.ecsonar.services.SonarService; import net.educoder.ecsonar.services.SonarService;
import net.educoder.ecsonar.utils.UrlUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -14,7 +12,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLDecoder;
/** /**
* @Author: youys * @Author: youys

@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory;
/** /**
* @Author: youys * @Author: youys
* @Date: 2022/1/18 * @Date: 2022/1/18
* @Description: * @Description:
*/ */
public class SonarQueryResultRunnable implements Runnable { public class SonarQueryResultRunnable implements Runnable {
@ -29,13 +29,13 @@ public class SonarQueryResultRunnable implements Runnable {
@Override @Override
public void run() { public void run() {
int count = 0;
String status; String status;
while((status = dbOperateService.queryCeActivityStatus(projectName)) == null){ while((status = dbOperateService.queryCeActivityStatus(projectName)) == null && count++ <=120){
LOGGER.info("detailId:[{}],sonar还未执行完,次数:{}", detailId, count);
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
LOGGER.info("detailId:[{}],sonar还未执行完", detailId);
} }
// 查询 // 查询
LOGGER.info("detailId:[{}], 查询sonar执行状态[{}]", detailId, status); LOGGER.info("detailId:[{}], 查询sonar执行状态[{}]", detailId, status);

Loading…
Cancel
Save