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
c8030ef8
Commit
c8030ef8
authored
May 13, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
24f81781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
33 deletions
+10
-33
LogBase.java
.../src/main/java/com/yanzuoguang/cloud/aop/log/LogBase.java
+10
-33
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/log/LogBase.java
View file @
c8030ef8
...
@@ -4,13 +4,10 @@ import com.yanzuoguang.cloud.CloudConfig;
...
@@ -4,13 +4,10 @@ import com.yanzuoguang.cloud.CloudConfig;
import
com.yanzuoguang.cloud.aop.LogFeign
;
import
com.yanzuoguang.cloud.aop.LogFeign
;
import
com.yanzuoguang.util.thread.ThreadNext
;
import
com.yanzuoguang.util.thread.ThreadNext
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.LogVo
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanInitializationException
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Optional
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
/**
/**
...
@@ -19,43 +16,23 @@ import java.util.concurrent.LinkedBlockingQueue;
...
@@ -19,43 +16,23 @@ import java.util.concurrent.LinkedBlockingQueue;
* @author 颜佐光
* @author 颜佐光
*/
*/
@Component
@Component
public
class
LogBase
implements
ThreadNext
.
Next
,
InitializingBean
,
ApplicationContextAware
{
public
class
LogBase
implements
ThreadNext
.
Next
,
InitializingBean
{
/**
/**
* 缓存队列
* 缓存队列
*/
*/
protected
volatile
LinkedBlockingQueue
<
LogVo
>
cache
=
new
LinkedBlockingQueue
<>();
protected
volatile
LinkedBlockingQueue
<
LogVo
>
cache
=
new
LinkedBlockingQueue
<>();
@Autowired
private
final
CloudConfig
cloudConfig
;
private
CloudConfig
cloudConfig
;
private
final
LogFeignBase
logFeign
;
private
LogFeignBase
logFeign
;
public
LogBase
(
CloudConfig
cloudConfig
,
LogFeignBase
logFeignBase
,
Optional
<
LogFeign
>
logFeign
)
{
this
.
cloudConfig
=
cloudConfig
;
/**
if
(
logFeign
.
isPresent
())
{
* Set the ApplicationContext that this object runs in.
this
.
logFeign
=
logFeign
.
get
();
* Normally this call will be used to initialize the object.
}
else
{
* <p>Invoked after population of normal bean properties but before an init callback such
this
.
logFeign
=
logFeignBase
;
* as {@link InitializingBean#afterPropertiesSet()}
* or a custom init-method. Invoked after {@link ResourceLoaderAware#setResourceLoader},
* {@link ApplicationEventPublisherAware#setApplicationEventPublisher} and
* {@link MessageSourceAware}, if applicable.
*
* @param applicationContext the ApplicationContext object to be used by this object
* @throws ApplicationContextException in case of context initialization errors
* @throws BeansException if thrown by application context methods
* @see BeanInitializationException
*/
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
// 获取个人实例话的对象
try
{
this
.
logFeign
=
applicationContext
.
getBean
(
LogFeign
.
class
);
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"请添加处理日志服务,实现LogFeign接口!"
);
System
.
err
.
println
(
"请添加处理日志服务,实现LogFeign接口!"
);
}
}
// 默认实例话对象
if
(
this
.
logFeign
==
null
)
{
this
.
logFeign
=
applicationContext
.
getBean
(
LogFeignBase
.
class
);
}
}
}
/**
/**
...
...
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