Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
246ae2ef
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
246ae2ef
编写于
9月 06, 2012
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://192.168.8.22:58422/cat
上级
f1c9b423
5aca17c8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
26 deletion
+53
-26
cat-core/src/main/java/com/dianping/cat/configuration/ClientConfigManager.java
...a/com/dianping/cat/configuration/ClientConfigManager.java
+12
-5
cat-core/src/main/java/com/dianping/cat/status/StatusInfoCollector.java
...ain/java/com/dianping/cat/status/StatusInfoCollector.java
+18
-3
cat-core/src/main/java/com/dianping/cat/status/StatusUpdateTask.java
...c/main/java/com/dianping/cat/status/StatusUpdateTask.java
+21
-18
cat-core/src/main/resources/META-INF/dal/model/client-codegen.xml
.../src/main/resources/META-INF/dal/model/client-codegen.xml
+1
-0
cat-core/src/main/resources/com/dianping/cat/configuration/client/config.xsd
...esources/com/dianping/cat/configuration/client/config.xsd
+1
-0
未找到文件。
cat-core/src/main/java/com/dianping/cat/configuration/ClientConfigManager.java
浏览文件 @
246ae2ef
...
...
@@ -36,6 +36,10 @@ public class ClientConfigManager implements LogEnabled {
}
}
public
ClientConfig
getClientConfig
()
{
return
m_config
;
}
public
Domain
getFirstDomain
()
{
if
(
m_config
==
null
)
{
return
new
Domain
(
"UNKNOWN"
).
setEnabled
(
false
);
...
...
@@ -54,10 +58,6 @@ public class ClientConfigManager implements LogEnabled {
return
m_config
.
getServers
();
}
}
public
ClientConfig
getClientConfig
(){
return
m_config
;
}
public
void
initialize
(
File
configFile
)
throws
Exception
{
ClientConfig
globalConfig
=
null
;
...
...
@@ -117,8 +117,15 @@ public class ClientConfigManager implements LogEnabled {
}
}
public
boolean
isDumpLocked
()
{
if
(
m_config
==
null
)
{
return
false
;
}
else
{
return
m_config
.
isDumpLocked
();
}
}
public
boolean
isInitialized
()
{
return
m_config
!=
null
;
}
}
cat-core/src/main/java/com/dianping/cat/status/StatusInfoCollector.java
浏览文件 @
246ae2ef
...
...
@@ -29,6 +29,8 @@ import com.dianping.cat.status.model.transform.BaseVisitor;
class
StatusInfoCollector
extends
BaseVisitor
{
private
MessageStatistics
m_statistics
;
private
boolean
m_dumpLocked
;
public
StatusInfoCollector
(
MessageStatistics
statistics
)
{
m_statistics
=
statistics
;
}
...
...
@@ -96,6 +98,11 @@ class StatusInfoCollector extends BaseVisitor {
return
isInstanceOfInterface
(
clazz
.
getSuperclass
(),
interfaceName
);
}
public
StatusInfoCollector
setDumpLocked
(
boolean
dumpLocked
)
{
m_dumpLocked
=
dumpLocked
;
return
this
;
}
@Override
public
void
visitDisk
(
DiskInfo
disk
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Disk"
,
"Disk"
);
...
...
@@ -221,15 +228,23 @@ class StatusInfoCollector extends BaseVisitor {
@Override
public
void
visitThread
(
ThreadsInfo
thread
)
{
ThreadMXBean
bean
=
ManagementFactory
.
getThreadMXBean
();
ThreadInfo
[]
threads
=
bean
.
dumpAllThreads
(
true
,
true
);
bean
.
setThreadContentionMonitoringEnabled
(
true
);
ThreadInfo
[]
threads
;
if
(
m_dumpLocked
)
{
threads
=
bean
.
dumpAllThreads
(
true
,
true
);
}
else
{
threads
=
bean
.
dumpAllThreads
(
false
,
false
);
}
thread
.
setCount
(
bean
.
getThreadCount
());
thread
.
setDaemonCount
(
bean
.
getDaemonThreadCount
());
thread
.
setPeekCount
(
bean
.
getPeakThreadCount
());
thread
.
setTotalStartedCount
((
int
)
bean
.
getTotalStartedThreadCount
());
thread
.
setCatThreadCount
(
countThreadsByPrefix
(
threads
,
"Cat-"
));
thread
.
setPigeonThreadCount
(
countThreadsByPrefix
(
threads
,
"Pigeon-"
,
"DPSF-"
,
"Netty-"
,
"Client-ResponseProcessor"
));
thread
.
setPigeonThreadCount
(
countThreadsByPrefix
(
threads
,
"Pigeon-"
,
"DPSF-"
,
"Netty-"
,
"Client-ResponseProcessor"
));
int
jbossThreadsCount
=
countThreadsByPrefix
(
threads
,
"http-"
);
int
jettyThreadsCount
=
countThreadsBySubstring
(
threads
,
"@qtp"
);
...
...
cat-core/src/main/java/com/dianping/cat/status/StatusUpdateTask.java
浏览文件 @
246ae2ef
...
...
@@ -21,7 +21,7 @@ import com.site.lookup.annotation.Inject;
public
class
StatusUpdateTask
implements
Task
,
Initializable
{
@Inject
private
MessageStatistics
m_statistics
;
@Inject
private
ClientConfigManager
m_manager
;
...
...
@@ -69,23 +69,26 @@ public class StatusUpdateTask implements Task, Initializable {
while
(
m_active
)
{
long
start
=
MilliSecondTimer
.
currentTimeMillis
();
if
(
m_manager
.
isCatEnabled
())
{
Transaction
t
=
cat
.
newTransaction
(
"System"
,
"Status"
);
Heartbeat
h
=
cat
.
newHeartbeat
(
"Heartbeat"
,
m_ipAddress
);
StatusInfo
status
=
new
StatusInfo
();
try
{
status
.
accept
(
new
StatusInfoCollector
(
m_statistics
));
h
.
addData
(
status
.
toString
());
h
.
setStatus
(
Message
.
SUCCESS
);
}
catch
(
Throwable
e
)
{
h
.
setStatus
(
e
);
cat
.
logError
(
e
);
}
finally
{
h
.
complete
();
}
t
.
setStatus
(
Message
.
SUCCESS
);
t
.
complete
();
}
Transaction
t
=
cat
.
newTransaction
(
"System"
,
"Status"
);
Heartbeat
h
=
cat
.
newHeartbeat
(
"Heartbeat"
,
m_ipAddress
);
StatusInfo
status
=
new
StatusInfo
();
t
.
addData
(
"dumpLocked"
,
m_manager
.
isDumpLocked
());
try
{
status
.
accept
(
new
StatusInfoCollector
(
m_statistics
).
setDumpLocked
(
m_manager
.
isDumpLocked
()));
h
.
addData
(
status
.
toString
());
h
.
setStatus
(
Message
.
SUCCESS
);
}
catch
(
Throwable
e
)
{
h
.
setStatus
(
e
);
cat
.
logError
(
e
);
}
finally
{
h
.
complete
();
}
t
.
setStatus
(
Message
.
SUCCESS
);
t
.
complete
();
}
long
elapsed
=
MilliSecondTimer
.
currentTimeMillis
()
-
start
;
if
(
elapsed
<
m_interval
)
{
...
...
cat-core/src/main/resources/META-INF/dal/model/client-codegen.xml
浏览文件 @
246ae2ef
...
...
@@ -3,6 +3,7 @@
<entity
name=
"config"
root=
"true"
>
<attribute
name=
"mode"
value-type=
"String"
/>
<attribute
name=
"enabled"
value-type=
"boolean"
/>
<attribute
name=
"dump-locked"
value-type=
"boolean"
/>
<entity-ref
name=
"server"
type=
"list"
names=
"servers"
xml-indent=
"true"
/>
<entity-ref
name=
"domain"
type=
"list"
names=
"domains"
/>
<entity-ref
name=
"bind"
/>
...
...
cat-core/src/main/resources/com/dianping/cat/configuration/client/config.xsd
浏览文件 @
246ae2ef
...
...
@@ -23,6 +23,7 @@
</xs:sequence>
<xs:attribute
name=
"mode"
type=
"xs:string"
use=
"required"
/>
<xs:attribute
name=
"enabled"
type=
"xs:boolean"
default=
"true"
/>
<xs:attribute
name=
"dump-locked"
type=
"xs:boolean"
/>
<xs:anyAttribute
processContents=
"lax"
/>
</xs:complexType>
<xs:complexType
name=
"ServerType"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录