Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
5c68fba3
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,发现更多精彩内容 >>
提交
5c68fba3
编写于
8月 21, 2012
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the cat memory leak problem
上级
d45e72f9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
20 deletion
+52
-20
cat-consumer/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
...m/dianping/cat/consumer/build/ComponentsConfigurator.java
+2
-1
cat-consumer/src/main/java/com/dianping/cat/consumer/common/CommonAnalyzer.java
...java/com/dianping/cat/consumer/common/CommonAnalyzer.java
+12
-3
cat-consumer/src/main/resources/META-INF/plexus/components.xml
...onsumer/src/main/resources/META-INF/plexus/components.xml
+3
-0
cat-core/src/main/java/com/dianping/cat/storage/BucketManager.java
...src/main/java/com/dianping/cat/storage/BucketManager.java
+4
-2
cat-core/src/main/java/com/dianping/cat/storage/DefaultBucketManager.java
...n/java/com/dianping/cat/storage/DefaultBucketManager.java
+20
-2
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+11
-11
cat-notify/src/main/java/com/dianping/cat/notify/render/VelocityRender.java
...n/java/com/dianping/cat/notify/render/VelocityRender.java
+0
-1
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
浏览文件 @
5c68fba3
...
...
@@ -77,7 +77,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
.
req
(
BucketManager
.
class
,
ReportDao
.
class
));
all
.
add
(
C
(
CommonAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
.
req
(
HostinfoDao
.
class
));
.
req
(
HostinfoDao
.
class
)
//
.
req
(
BucketManager
.
class
));
all
.
add
(
C
(
TopIpAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
.
req
(
BucketManager
.
class
,
ReportDao
.
class
));
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/common/CommonAnalyzer.java
浏览文件 @
5c68fba3
...
...
@@ -14,6 +14,7 @@ import com.dianping.cat.hadoop.dal.Hostinfo;
import
com.dianping.cat.hadoop.dal.HostinfoDao
;
import
com.dianping.cat.message.spi.AbstractMessageAnalyzer
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.storage.BucketManager
;
import
com.site.dal.jdbc.DalException
;
import
com.site.lookup.annotation.Inject
;
...
...
@@ -24,11 +25,19 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
@Inject
private
HostinfoDao
m_hostInfoDao
;
@Inject
private
BucketManager
m_bucketManager
;
@Override
public
void
doCheckpoint
(
boolean
atEnd
)
{
//
if (atEnd) {
if
(
atEnd
)
{
storeReport
();
//}
}
try
{
m_bucketManager
.
closeAllLogviewBuckets
();
}
catch
(
Exception
e
)
{
m_logger
.
error
(
"Close logviewbucket error"
,
e
);
}
}
private
void
storeReport
()
{
...
...
@@ -38,7 +47,7 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
for
(
String
ip
:
ips
)
{
Hostinfo
info
=
m_hostInfoDao
.
createLocal
();
info
.
setDomain
(
domain
);
info
.
setIp
(
ip
);
try
{
...
...
cat-consumer/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
5c68fba3
...
...
@@ -130,6 +130,9 @@
<requirement>
<role>
com.dianping.cat.hadoop.dal.HostinfoDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.storage.BucketManager
</role>
</requirement>
</requirements>
</component>
<component>
...
...
cat-core/src/main/java/com/dianping/cat/storage/BucketManager.java
浏览文件 @
5c68fba3
...
...
@@ -6,12 +6,14 @@ import java.util.List;
import
com.dianping.cat.message.spi.MessageTree
;
public
interface
BucketManager
{
public
void
closeAllLogviewBuckets
();
public
void
closeBucket
(
Bucket
<?>
bucket
);
public
List
<
Bucket
<
MessageTree
>>
getLogviewBuckets
(
long
timestamp
,
String
excludeDomain
)
throws
IOException
;
public
Bucket
<
MessageTree
>
getLogviewBucket
(
long
timestamp
,
String
domain
)
throws
IOException
;
public
List
<
Bucket
<
MessageTree
>>
getLogviewBuckets
(
long
timestamp
,
String
excludeDomain
)
throws
IOException
;
public
Bucket
<
MessageTree
>
getMessageBucket
(
long
timestamp
,
String
domain
)
throws
IOException
;
public
Bucket
<
String
>
getReportBucket
(
long
timestamp
,
String
name
)
throws
IOException
;
...
...
cat-core/src/main/java/com/dianping/cat/storage/DefaultBucketManager.java
浏览文件 @
5c68fba3
...
...
@@ -84,11 +84,11 @@ public class DefaultBucketManager extends ContainerHolder implements BucketManag
public
List
<
Bucket
<
MessageTree
>>
getLogviewBuckets
(
long
timestamp
,
String
excludeDomain
)
throws
IOException
{
long
t
=
timestamp
-
timestamp
%
(
60
*
60
*
1000L
);
List
<
Bucket
<
MessageTree
>>
buckets
=
new
ArrayList
<
Bucket
<
MessageTree
>>();
for
(
Bucket
<?>
bucket
:
m_map
.
values
())
{
if
(
bucket
instanceof
LocalLogviewBucket
)
{
LocalLogviewBucket
logview
=
(
LocalLogviewBucket
)
bucket
;
if
(
logview
.
getTimestamp
()
==
t
&&
!
logview
.
getDomain
().
equals
(
excludeDomain
))
{
buckets
.
add
(
logview
);
}
...
...
@@ -149,4 +149,22 @@ public class DefaultBucketManager extends ContainerHolder implements BucketManag
return
String
.
format
(
"Entry[type=%s,path=%s]"
,
m_type
,
m_path
);
}
}
@Override
public
void
closeAllLogviewBuckets
()
{
int
hour
=
60
*
60
*
1000
;
long
currentTimeMillis
=
System
.
currentTimeMillis
();
long
lastHour
=
currentTimeMillis
-
currentTimeMillis
%
hour
-
2
*
hour
;
for
(
Bucket
<?>
bucket
:
m_map
.
values
())
{
if
(
bucket
instanceof
LocalLogviewBucket
)
{
long
timestamp
=
((
LocalLogviewBucket
)
bucket
).
getTimestamp
();
if
(
timestamp
<
lastHour
)
{
LocalLogviewBucket
logview
=
(
LocalLogviewBucket
)
bucket
;
closeBucket
(
logview
);
}
}
}
}
}
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
5c68fba3
...
...
@@ -1566,32 +1566,32 @@
<implementation>
com.dianping.cat.report.page.cache.Handler
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.
report.page.cache.JspViewer
</role>
<role>
com.dianping.cat.
hadoop.dal.DailyreportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.
hadoop.dal.ReportDao
</role>
<role>
com.dianping.cat.
report.task.event.EventMerger
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.hadoop.dal.DailyreportDao
</role>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
event
</role-hint>
<field-name>
m_eventService
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.
task.event.EventMerg
er
</role>
<role>
com.dianping.cat.report.
page.cache.JspView
er
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.
report.task.transaction.TransactionMer
ger
</role>
<role>
com.dianping.cat.
configuration.ServerConfigMana
ger
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.
configuration.ServerConfigManager
</role>
<role>
com.dianping.cat.
hadoop.dal.ReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
transaction
</role-hint>
<field-name>
m_transactionService
</field-name>
<role>
com.dianping.cat.report.task.transaction.TransactionMerger
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
event
</role-hint>
<field-name>
m_
event
Service
</field-name>
<role-hint>
transaction
</role-hint>
<field-name>
m_
transaction
Service
</field-name>
</requirement>
</requirements>
</component>
...
...
cat-notify/src/main/java/com/dianping/cat/notify/render/VelocityRender.java
浏览文件 @
5c68fba3
...
...
@@ -15,7 +15,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
com.dianping.cat.notify.config.ConfigContext
;
import
com.dianping.cat.notify.report.AbstractReportCreater
;
public
class
VelocityRender
implements
IRender
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录