Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
80e66d76
Commit
80e66d76
authored
May 07, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消除成功接收处理
parent
6851c5fb
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
52 additions
and
13 deletions
+52
-13
RunnableListAuto.java
...in/java/com/yanzuoguang/util/thread/RunnableListAuto.java
+6
-2
RunnableListAutoItem.java
...ava/com/yanzuoguang/util/thread/RunnableListAutoItem.java
+5
-3
ThreadNext.java
...src/main/java/com/yanzuoguang/util/thread/ThreadNext.java
+5
-0
CloudContans.java
...oud/src/main/java/com/yanzuoguang/cloud/CloudContans.java
+12
-0
LogFeign.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/LogFeign.java
+2
-0
MqAspect.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
+2
-1
WebAspect.java
...ud/src/main/java/com/yanzuoguang/cloud/aop/WebAspect.java
+2
-1
BaseService.java
...db/src/main/java/com/yanzuoguang/service/BaseService.java
+6
-0
BaseServiceImpl.java
...in/java/com/yanzuoguang/service/impl/BaseServiceImpl.java
+4
-3
MessageService.java
.../main/java/com/yanzuoguang/mq/service/MessageService.java
+5
-2
MqService.java
...q/src/main/java/com/yanzuoguang/mq/service/MqService.java
+3
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAuto.java
View file @
80e66d76
...
...
@@ -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
());
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAutoItem.java
View file @
80e66d76
...
...
@@ -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
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadNext.java
View file @
80e66d76
...
...
@@ -5,15 +5,20 @@ import com.yanzuoguang.util.log.Log;
/**
* 线程执行类
*
* @author 颜佐光
*/
public
class
ThreadNext
{
/**
* 下一个处理结接口
*/
public
interface
Next
{
/**
* 执行下一个函数,出现异常会继续执行
*
* @return 是否继续执行
* @throws Exception 异常信息
*/
boolean
next
()
throws
Exception
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/CloudContans.java
0 → 100644
View file @
80e66d76
package
com
.
yanzuoguang
.
cloud
;
/**
*
*/
public
class
CloudContans
{
/**
* 日志模块
*/
public
static
final
String
LOG_MODULE
=
"log"
;
}
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/LogFeign.java
View file @
80e66d76
...
...
@@ -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
);
}
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
View file @
80e66d76
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
;
}
// 正常请求不记录
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/WebAspect.java
View file @
80e66d76
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
;
}
// 正常请求不记录
...
...
yzg-util-db/src/main/java/com/yanzuoguang/service/BaseService.java
View file @
80e66d76
...
...
@@ -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
);
}
yzg-util-db/src/main/java/com/yanzuoguang/service/impl/BaseServiceImpl.java
View file @
80e66d76
...
...
@@ -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
();
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/MessageService.java
View file @
80e66d76
...
...
@@ -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
);
}
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/MqService.java
View file @
80e66d76
...
...
@@ -10,13 +10,15 @@ import org.springframework.amqp.core.Message;
/**
* 消息队列服务
*
* @author 颜佐光
*/
public
interface
MqService
{
/**
* 保存演示DEMO
*
* @param req
* @param req 需要发送的消息
* @return 创建队列
*/
String
createQueue
(
QueueVo
req
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment