Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
45bac2a8
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,发现更多精彩内容 >>
提交
45bac2a8
编写于
8月 15, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unused CatClientModule class
上级
0fd2b8fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
99 deletion
+0
-99
cat-core/src/main/java/com/dianping/cat/CatClientModule.java
cat-core/src/main/java/com/dianping/cat/CatClientModule.java
+0
-97
cat-core/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+0
-2
未找到文件。
cat-core/src/main/java/com/dianping/cat/CatClientModule.java
已删除
100644 → 0
浏览文件 @
0fd2b8fb
package
com.dianping.cat
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.util.concurrent.locks.LockSupport
;
import
com.dianping.cat.configuration.ClientConfigManager
;
import
com.dianping.cat.configuration.ClientConfigMerger
;
import
com.dianping.cat.configuration.client.entity.ClientConfig
;
import
com.dianping.cat.configuration.client.transform.DefaultDomParser
;
import
com.dianping.cat.message.io.TransportManager
;
import
com.dianping.cat.status.StatusUpdateTask
;
import
com.site.helper.Files
;
import
com.site.helper.Threads
;
import
com.site.initialization.AbstractModule
;
import
com.site.initialization.DefaultModuleContext
;
import
com.site.initialization.Module
;
import
com.site.initialization.ModuleContext
;
public
class
CatClientModule
extends
AbstractModule
{
public
static
final
String
ID
=
"cat-client"
;
private
static
final
String
CAT_CLIENT_XML
=
"/META-INF/cat/client.xml"
;
@Override
protected
void
execute
(
final
ModuleContext
ctx
)
throws
Exception
{
File
clientConfigFile
=
ctx
.
getAttribute
(
"cat-client-config-file"
);
ClientConfigManager
clientConfigManager
=
ctx
.
lookup
(
ClientConfigManager
.
class
);
clientConfigManager
.
initialize
(
clientConfigFile
);
// warm up Cat
Cat
.
getInstance
().
setContainer
(((
DefaultModuleContext
)
ctx
).
getContainer
());
// bring up TransportManager
ctx
.
lookup
(
TransportManager
.
class
);
// start status update task
if
(
clientConfigManager
.
isCatEnabled
())
{
StatusUpdateTask
statusUpdateTask
=
ctx
.
lookup
(
StatusUpdateTask
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
statusUpdateTask
);
LockSupport
.
parkNanos
(
10
*
1000
*
1000L
);
// wait 10 ms
}
}
@Override
public
Module
[]
getDependencies
(
ModuleContext
ctx
)
{
return
ctx
.
getModules
(
CatCoreModule
.
ID
);
}
ClientConfig
loadClientConfig
(
ModuleContext
ctx
,
File
configFile
)
{
ClientConfig
globalConfig
=
null
;
ClientConfig
clientConfig
=
null
;
try
{
// read the global configure from local file system
// so that OPS can:
// - configure the cat servers to connect
// - enable/disable Cat for specific domain(s)
if
(
configFile
!=
null
)
{
if
(
configFile
.
exists
())
{
String
xml
=
Files
.
forIO
().
readFrom
(
configFile
.
getCanonicalFile
(),
"utf-8"
);
globalConfig
=
new
DefaultDomParser
().
parse
(
xml
);
ctx
.
info
(
String
.
format
(
"Global config file(%s) found."
,
configFile
));
}
else
{
ctx
.
warn
(
String
.
format
(
"Global config file(%s) not found, IGNORED."
,
configFile
));
}
}
// load the client configure from Java class-path
if
(
clientConfig
==
null
)
{
InputStream
in
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
CAT_CLIENT_XML
);
if
(
in
==
null
)
{
in
=
Cat
.
class
.
getResourceAsStream
(
CAT_CLIENT_XML
);
}
if
(
in
!=
null
)
{
String
xml
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
clientConfig
=
new
DefaultDomParser
().
parse
(
xml
);
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"Error when loading configuration file(%s)!"
,
configFile
),
e
);
}
// merge the two configures together to make it effected
if
(
globalConfig
!=
null
&&
clientConfig
!=
null
)
{
globalConfig
.
accept
(
new
ClientConfigMerger
(
clientConfig
));
}
return
clientConfig
;
}
}
cat-core/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
45bac2a8
...
...
@@ -3,7 +3,6 @@ package com.dianping.cat.build;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.dianping.cat.CatClientModule
;
import
com.dianping.cat.CatCoreModule
;
import
com.dianping.cat.configuration.ClientConfigManager
;
import
com.dianping.cat.configuration.ServerConfigManager
;
...
...
@@ -105,7 +104,6 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
.
req
(
ServerConfigManager
.
class
,
MessagePathBuilder
.
class
));
all
.
add
(
C
(
Module
.
class
,
CatCoreModule
.
ID
,
CatCoreModule
.
class
));
all
.
add
(
C
(
Module
.
class
,
CatClientModule
.
ID
,
CatClientModule
.
class
));
all
.
addAll
(
new
CodecComponentConfigurator
().
defineComponents
());
all
.
addAll
(
new
StorageComponentConfigurator
().
defineComponents
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录