Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
161fa2bd
Commit
161fa2bd
authored
Jan 25, 2021
by
房斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
breakbug 加监听日志
parent
5293c91d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
40 deletions
+47
-40
RegistryServerSync.java
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/monitor/dubbo/service/RegistryServerSync.java
+3
-1
DubboCustomerDownHock.java
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/service/impl/DubboCustomerDownHock.java
+7
-2
GracefullyShoutDown.java
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/spring/boot/autoconfigure/GracefullyShoutDown.java
+37
-37
No files found.
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/monitor/dubbo/service/RegistryServerSync.java
View file @
161fa2bd
...
...
@@ -199,8 +199,10 @@ public class RegistryServerSync implements InitializingBean, DisposableBean, Not
while
(
iterator
.
hasNext
())
{
Registry
r
=
iterator
.
next
();
zookperRegster
=
(
ZookeeperRegistry
)
r
;
logger
.
info
(
"RegistryServerSync r-------------->"
+
zookperRegster
.
getRegistered
().
toString
());
if
(
zookperRegster
.
getRegistered
()
!=
null
&&
zookperRegster
.
getRegistered
().
size
()
>
0
)
{
urls
=
zookperRegster
.
getRegistered
();
logger
.
info
(
"RegistryServerSync urls-------------->"
+((
urls
!=
null
&&
urls
.
size
()>
0
)?
JSON
.
toJSONString
(
urls
):
"url si null"
));
if
(
urls
!=
null
&&
urls
.
size
()
>
0
)
{
for
(
URL
value:
urls
){
try
{
...
...
@@ -211,9 +213,9 @@ public class RegistryServerSync implements InitializingBean, DisposableBean, Not
}
}
}
break
;
}
break
;
}
}
...
...
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/service/impl/DubboCustomerDownHock.java
View file @
161fa2bd
package
com
.
secoo
.
mall
.
dubbo
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.secoo.mall.common.core.bean.gracefulshowtdownBean.ExecutorDetail
;
import
com.secoo.mall.common.util.date.DateUtil
;
import
com.secoo.mall.common.util.log.LoggerUtil
;
...
...
@@ -39,7 +40,7 @@ public class DubboCustomerDownHock extends AbstractStop {
public
ExecutorDetail
stop
()
{
ExecutorDetail
detail
=
new
ExecutorDetail
();
detail
.
setBeginTime
(
DateUtil
.
getDateTime
());
detail
.
setServiceName
(
"dubboDownHock100
1
"
);
detail
.
setServiceName
(
"dubboDownHock100
5
"
);
List
<
String
>
str
=
new
ArrayList
<
String
>();
detail
.
setDetail
(
str
);
detail
.
setCode
(
0
);
...
...
@@ -56,8 +57,10 @@ public class DubboCustomerDownHock extends AbstractStop {
while
(
iterator
.
hasNext
())
{
Registry
r
=
iterator
.
next
();
zookperRegster
=
(
ZookeeperRegistry
)
r
;
logger
.
info
(
"RegistryServerSync r-------------->"
+
zookperRegster
.
getRegistered
().
toString
());
if
(
zookperRegster
.
getRegistered
()
!=
null
&&
zookperRegster
.
getRegistered
().
size
()
>
0
)
{
urls
=
zookperRegster
.
getRegistered
();
logger
.
info
(
"RegistryServerSync urls-------------->"
+((
urls
!=
null
&&
urls
.
size
()>
0
)?
JSON
.
toJSONString
(
urls
):
"url si null"
));
if
(
urls
!=
null
&&
urls
.
size
()
>
0
)
{
checks
=
new
ArrayList
<
URL
>();
for
(
URL
value
:
urls
)
{
...
...
@@ -76,9 +79,10 @@ public class DubboCustomerDownHock extends AbstractStop {
str
.
add
(
"warn:matrix-monitor no dubbo registered for delete ip "
+
ip
+
" name :"
+
name
+
StringUtil
.
line
());
detail
.
setCode
(-
1
);
}
break
;
}
break
;
}
}
//step3 check检查
...
...
@@ -107,6 +111,7 @@ public class DubboCustomerDownHock extends AbstractStop {
}
}
}
else
{
detail
.
setCode
(-
1
);
str
.
add
(
"warn:matrix-monitor no urls check ip:"
+
ip
+
" name :"
+
name
+
StringUtil
.
line
());
logger
.
info
(
"warn:matrix-monitor no urls check ip:"
+
ip
+
" name :"
+
name
+
StringUtil
.
line
());
}
...
...
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/spring/boot/autoconfigure/GracefullyShoutDown.java
View file @
161fa2bd
...
...
@@ -76,44 +76,44 @@ public class GracefullyShoutDown implements CommandLineRunner, ApplicationListen
//test-------------------------------------> begin
ExecutorDetails
result
=
new
ExecutorDetails
();
result
.
setCode
(
0
);
List
<
ExecutorDetail
>
details
=
new
ArrayList
<
ExecutorDetail
>();
result
.
setT
(
details
);
String
ip
=
NetUtils
.
getIpByHost
(
NetUtils
.
getLocalAddress
().
getHostName
());
String
name
=
ApplicationModel
.
getApplication
();
result
.
setIp
(
ip
);
result
.
setName
(
name
);
// ExecutorDetails result = new ExecutorDetails();
// result.setCode(0);
// List<ExecutorDetail> details = new ArrayList<ExecutorDetail>();
// result.setT(details);
// String ip = NetUtils.getIpByHost(NetUtils.getLocalAddress().getHostName());
// String name = ApplicationModel.getApplication();
// result.setIp(ip);
// result.setName(name);
////
// try {
// Map<String, StopService> map = this.context.getBeansOfType(StopService.class);
// if (map != null && map.size() > 0) {
// Set<StopService> ts = new TreeSet<StopService>();
// for (StopService service : map.values()) {
// ts.add(service);
// }
// //按定义顺序执行
// Iterator<StopService> it = ts.iterator();
// while (it.hasNext()) {
// StopService service = (StopService) it.next();
// ExecutorDetail one = (ExecutorDetail) service.stop();
// if (one != null) {
// details.add(one);
// if (one.getCode() != 0) {
// result.setCode(-1);
// } }
////
//// }
//// } catch (Exception e) {
//// LoggerUtil.error("matrix.GracefullyShoutDown.error", e);
//// }
//// try {
//// dubboUpdata.upData(result);
//// } catch (Exception e) {
//// LoggerUtil.error("matrix.GracefullyShoutDown update .error data:" + JSON.toJSONString(result), e);
//// }
// }
//
try
{
Map
<
String
,
StopService
>
map
=
this
.
context
.
getBeansOfType
(
StopService
.
class
);
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
Set
<
StopService
>
ts
=
new
TreeSet
<
StopService
>();
for
(
StopService
service
:
map
.
values
())
{
ts
.
add
(
service
);
}
//按定义顺序执行
Iterator
<
StopService
>
it
=
ts
.
iterator
();
while
(
it
.
hasNext
())
{
StopService
service
=
(
StopService
)
it
.
next
();
ExecutorDetail
one
=
(
ExecutorDetail
)
service
.
stop
();
if
(
one
!=
null
)
{
details
.
add
(
one
);
if
(
one
.
getCode
()
!=
0
)
{
result
.
setCode
(-
1
);
}
}
}
}
}
catch
(
Exception
e
)
{
LoggerUtil
.
error
(
"matrix.GracefullyShoutDown.error"
,
e
);
}
try
{
dubboUpdata
.
upData
(
result
);
}
catch
(
Exception
e
)
{
LoggerUtil
.
error
(
"matrix.GracefullyShoutDown update .error data:"
+
JSON
.
toJSONString
(
result
),
e
);
}
//test------------------------------------->
...
...
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