Commit 80e66d76 authored by yanzg's avatar yanzg

消除成功接收处理

parent 6851c5fb
......@@ -6,10 +6,14 @@ import java.util.*;
/**
* 执行队列的数据,会根据其中的执行函数,自动优化执行循序
*
* @author 颜佐光
*/
public final class RunnableListAuto {
/**
* 最小线程数量
*/
public static final int MIN_THREAD = 2;
/**
* 是否打印线程日志
*/
......@@ -107,7 +111,7 @@ public final class RunnableListAuto {
// 计算线程数量
maxAvg = Math.max(maxAvg, 1);
int threadCount = zeroCount + (int) (totalAvg / maxAvg);
if (threadCount > 2) {
if (threadCount > MIN_THREAD) {
threadCount = threadCount - 1;
}
threadCount = Math.min(threadCount, methods.size());
......
......@@ -7,6 +7,7 @@ import java.util.Date;
/**
* 自动执行队列的某一项
*
* @author 颜佐光
*/
public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
......@@ -82,9 +83,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
* 则Time = time/2, count = count/2;
*/
private synchronized void init() {
if (this.time > Long.MAX_VALUE / 2 || this.count > Integer.MAX_VALUE / 2) {
this.time = this.time / 2;
this.count = this.count / 2;
if (this.time > Long.MAX_VALUE / RunnableListAuto.MIN_THREAD
|| this.count > Integer.MAX_VALUE / RunnableListAuto.MIN_THREAD) {
this.time = this.time / RunnableListAuto.MIN_THREAD;
this.count = this.count / RunnableListAuto.MIN_THREAD;
}
}
......
......@@ -5,15 +5,20 @@ import com.yanzuoguang.util.log.Log;
/**
* 线程执行类
*
* @author 颜佐光
*/
public class ThreadNext {
/**
* 下一个处理结接口
*/
public interface Next {
/**
* 执行下一个函数,出现异常会继续执行
*
* @return 是否继续执行
* @throws Exception 异常信息
*/
boolean next() throws Exception;
......
package com.yanzuoguang.cloud;
/**
*
*/
public class CloudContans {
/**
* 日志模块
*/
public static final String LOG_MODULE = "log";
}
......@@ -5,6 +5,7 @@ import com.yanzuoguang.util.vo.ResponseResult;
/**
* 调用外置服务保存日志对象
*
* @author 颜佐光
*/
public interface LogFeign {
......@@ -13,6 +14,7 @@ public interface LogFeign {
* 保存日志对象
*
* @param log 需要保存的日志对象
* @return 日志服务返回结果
*/
ResponseResult<String> save(LogVo log);
}
package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.cloud.CloudContans;
import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.exception.ExceptionHelper;
import com.yanzuoguang.util.helper.StringHelper;
......@@ -77,7 +78,7 @@ public class MqAspect extends BaseRequestAspect {
*/
private void saveInterLogs(ProceedingJoinPoint joinPoint, ResponseResult responseResult) {
// 日志请求不记录,防止死循环递归
if (applicationName.indexOf("log") >= 0) {
if (applicationName.indexOf(CloudContans.LOG_MODULE) >= 0) {
return;
}
// 正常请求不记录
......
package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.cloud.CloudContans;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.exception.ExceptionHelper;
......@@ -146,7 +147,7 @@ public class WebAspect extends BaseRequestAspect {
*/
private void saveInterLogs(ProceedingJoinPoint joinPoint, ResponseResult responseResult) {
// 日志请求不记录,防止死循环递归
if (applicationName.indexOf("log") >= 0) {
if (applicationName.indexOf(CloudContans.LOG_MODULE) >= 0) {
return;
}
// 正常请求不记录
......
......@@ -4,6 +4,7 @@ import java.util.List;
/**
* 基本服务接口
*
* @author 颜佐光
*/
public interface BaseService<T> {
......@@ -11,6 +12,7 @@ public interface BaseService<T> {
* 创建数据
*
* @param models 需要创建的数据
* @return 创建id集合
*/
List<String> create(T... models);
......@@ -18,6 +20,7 @@ public interface BaseService<T> {
* 修改数据
*
* @param models 需要修改的数据
* @return 创建id集合
*/
List<String> update(T... models);
......@@ -25,6 +28,7 @@ public interface BaseService<T> {
* 保存数据
*
* @param models 需要保存的数据
* @return 创建id集合
*/
List<String> save(T... models);
......@@ -32,6 +36,7 @@ public interface BaseService<T> {
* 删除数据
*
* @param models 需要删除的数据
* @return 创建id集合
*/
int remove(T... models);
......@@ -39,6 +44,7 @@ public interface BaseService<T> {
* 加载数据
*
* @param models 需要删除的数据
* @return 创建id集合
*/
List<T> load(T... models);
}
......@@ -10,6 +10,7 @@ import java.util.List;
/**
* 基本服务实现
*
* @author 颜佐光
*/
public abstract class BaseServiceImpl<T> implements BaseService<T> {
......@@ -35,9 +36,9 @@ public abstract class BaseServiceImpl<T> implements BaseService<T> {
/**
* @param
* @return
* @description 获取Dao类来处理
* 获取Dao类来处理
*
* @return Dao层操作类
*/
protected abstract BaseDao getDao();
......
......@@ -7,6 +7,7 @@ import java.util.List;
/**
* 发送消息服务
*
* @author 颜佐光
*/
public interface MessageService {
......@@ -39,14 +40,16 @@ public interface MessageService {
/**
* 消息发送成功
*
* @param id
* @param id 编号
* @return 成功后返回编号
*/
String onSuccess(String id);
/**
* 消息发送失败
*
* @param messageVo
* @param messageVo 消息处理错误
* @return 成功后返回编号
*/
String onError(MessageVo messageVo);
}
......@@ -10,13 +10,15 @@ import org.springframework.amqp.core.Message;
/**
* 消息队列服务
*
* @author 颜佐光
*/
public interface MqService {
/**
* 保存演示DEMO
*
* @param req
* @param req 需要发送的消息
* @return 创建队列
*/
String createQueue(QueueVo req);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment