阿里插件规范部分代码。

pull/6/head
3y 3 years ago
parent 19f3093d23
commit d17c51d9c5

@ -48,7 +48,8 @@ public class NightShieldLazyPendingHandler {
String taskInfo = redisUtils.lPop(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY);
if (StrUtil.isNotBlank(taskInfo)) {
try {
kafkaUtils.send(topicName, JSON.toJSONString(Arrays.asList(JSON.parseObject(taskInfo, TaskInfo.class)), new SerializerFeature[]{SerializerFeature.WriteClassName}));
kafkaUtils.send(topicName, JSON.toJSONString(Arrays.asList(JSON.parseObject(taskInfo, TaskInfo.class))
, new SerializerFeature[]{SerializerFeature.WriteClassName}));
} catch (Exception e) {
log.error("nightShieldLazyJob send kafka fail! e:{},params:{}", Throwables.getStackTraceAsString(e), taskInfo);
}

@ -10,5 +10,9 @@ import com.java3y.austin.common.domain.TaskInfo;
public interface ShieldService {
/**
*
* @param taskInfo
*/
void shield(TaskInfo taskInfo);
}

@ -20,6 +20,7 @@ import java.util.HashSet;
/**
*
* @author 3y
*/
@Service
@Slf4j
@ -40,10 +41,12 @@ public class ShieldServiceImpl implements ShieldService {
*/
if (isNight()) {
if (ShieldType.NIGHT_SHIELD.getCode().equals(taskInfo.getShieldType())) {
logUtils.print(AnchorInfo.builder().state(AnchorState.NIGHT_SHIELD.getCode()).businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).build());
logUtils.print(AnchorInfo.builder().state(AnchorState.NIGHT_SHIELD.getCode())
.businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).build());
}
if (ShieldType.NIGHT_SHIELD_BUT_NEXT_DAY_SEND.getCode().equals(taskInfo.getShieldType())) {
redisUtils.lPush(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY, JSON.toJSONString(taskInfo, new SerializerFeature[]{SerializerFeature.WriteClassName}),
redisUtils.lPush(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY, JSON.toJSONString(taskInfo,
new SerializerFeature[]{SerializerFeature.WriteClassName}),
(DateUtil.offsetDay(new Date(), 1).getTime() / 1000) - DateUtil.currentSeconds());
logUtils.print(AnchorInfo.builder().state(AnchorState.NIGHT_SHIELD_NEXT_SEND.getCode()).businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).build());
}

@ -1,24 +0,0 @@
package com.java3y.austin.web.controller;
import com.dtp.core.DtpRegistry;
import com.dtp.core.thread.DtpExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ThreadPoolTest {
@GetMapping("/tp")
public void send() {
DtpExecutor dtpExecutor1 = DtpRegistry.getExecutor("austin-im.notice");
DtpExecutor dtpExecutor2 = DtpRegistry.getExecutor("execute-xxl-thread-pool");
DtpExecutor dtpExecutor3 = DtpRegistry.getExecutor("dynamic-tp-test-2");
System.out.println(dtpExecutor1);
System.out.println(dtpExecutor2);
System.out.println(dtpExecutor3);
}
}
Loading…
Cancel
Save