测试线程池
parent
ef9f2e4b6a
commit
80c96da4b2
|
@ -2,6 +2,7 @@ package com.muyu.task.feign;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.domain.DataValue;
|
import com.muyu.domain.DataValue;
|
||||||
|
import com.muyu.task.feign.factory.DataValueClientFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -17,7 +18,7 @@ import java.util.List;
|
||||||
* @date: 2024/9/4 15:13
|
* @date: 2024/9/4 15:13
|
||||||
*/
|
*/
|
||||||
//,fallback = TaskFeignFallback.class
|
//,fallback = TaskFeignFallback.class
|
||||||
@FeignClient(name = "cloud-source" )
|
@FeignClient(name = "cloud-source",fallbackFactory = DataValueClientFactory.class)
|
||||||
public interface DataValueClient {
|
public interface DataValueClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.muyu.task.feign.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.DataValue;
|
||||||
|
import com.muyu.task.feign.DataValueClient;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @PackageName:com.muyu.task.feign.factory
|
||||||
|
* @ClassName:DataValueClientFactory
|
||||||
|
* @Description:
|
||||||
|
* @author: ¥陈思豪¥
|
||||||
|
* @date: 2024/9/9 10:48
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class DataValueClientFactory implements FallbackFactory<DataValueClient> {
|
||||||
|
@Override
|
||||||
|
public DataValueClient create(Throwable cause) {
|
||||||
|
return new DataValueClient() {
|
||||||
|
@Override
|
||||||
|
public Result<List<List<DataValue>>> findTableValue(Long basicId, String sql) {
|
||||||
|
return Result.error("网络开小差");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findCount(Long basicId, String sql) {
|
||||||
|
return 111111111;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result addTableDataValue(Long basicId, Long tableId, List<List<DataValue>> dataValue) {
|
||||||
|
return Result.error("网络开小差");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataValue[][] findTableValueToArray(Long basicId, String sql, Long one, Integer two) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result addProduct(Long basicId, Long tableId, DataValue[][] listList) {
|
||||||
|
return Result.error("网络开小差");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -300,7 +300,7 @@ public class PriorityThreadPool {
|
||||||
task.run();
|
task.run();
|
||||||
log.info("执行任务完毕??");
|
log.info("执行任务完毕??");
|
||||||
} finally {
|
} finally {
|
||||||
// lowPrioritySemaphore.release();
|
lowPrioritySemaphore.release();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
Loading…
Reference in New Issue