Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
04a524ef
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,发现更多精彩内容 >>
提交
04a524ef
编写于
9月 13, 2012
作者:
Y
Yiming Liu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://192.168.8.22:58422/cat
上级
e046cb85
6dbc55e3
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
610 addition
and
427 deletion
+610
-427
dog-home/src/main/java/com/dianping/dog/alarm/alert/AlertEventListener.java
...java/com/dianping/dog/alarm/alert/AlertEventListener.java
+33
-0
dog-home/src/main/java/com/dianping/dog/alarm/connector/DataService.java
...in/java/com/dianping/dog/alarm/connector/DataService.java
+1
-1
dog-home/src/main/java/com/dianping/dog/alarm/connector/RowData.java
...c/main/java/com/dianping/dog/alarm/connector/RowData.java
+1
-1
dog-home/src/main/java/com/dianping/dog/alarm/data/DataEvent.java
.../src/main/java/com/dianping/dog/alarm/data/DataEvent.java
+1
-0
dog-home/src/main/java/com/dianping/dog/alarm/data/TransactionEvent.java
...in/java/com/dianping/dog/alarm/data/TransactionEvent.java
+0
-5
dog-home/src/main/java/com/dianping/dog/alarm/entity/Duration.java
...src/main/java/com/dianping/dog/alarm/entity/Duration.java
+15
-6
dog-home/src/main/java/com/dianping/dog/alarm/entity/RuleEntity.java
...c/main/java/com/dianping/dog/alarm/entity/RuleEntity.java
+5
-39
dog-home/src/main/java/com/dianping/dog/alarm/filter/ProblemFilterListener.java
.../com/dianping/dog/alarm/filter/ProblemFilterListener.java
+20
-5
dog-home/src/main/java/com/dianping/dog/alarm/merge/ProblemMergeListener.java
...va/com/dianping/dog/alarm/merge/ProblemMergeListener.java
+16
-7
dog-home/src/main/java/com/dianping/dog/alarm/problem/AlertEvent.java
.../main/java/com/dianping/dog/alarm/problem/AlertEvent.java
+57
-0
dog-home/src/main/java/com/dianping/dog/alarm/problem/ProblemEvent.java
...ain/java/com/dianping/dog/alarm/problem/ProblemEvent.java
+1
-1
dog-home/src/main/java/com/dianping/dog/alarm/rule/AlarmStrategy.java
.../main/java/com/dianping/dog/alarm/rule/AlarmStrategy.java
+0
-28
dog-home/src/main/java/com/dianping/dog/alarm/rule/AlarmType.java
.../src/main/java/com/dianping/dog/alarm/rule/AlarmType.java
+5
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/DataVistor.java
...src/main/java/com/dianping/dog/alarm/rule/DataVistor.java
+0
-7
dog-home/src/main/java/com/dianping/dog/alarm/rule/DefaultRuleManager.java
.../java/com/dianping/dog/alarm/rule/DefaultRuleManager.java
+0
-53
dog-home/src/main/java/com/dianping/dog/alarm/rule/ExceptionRule.java
.../main/java/com/dianping/dog/alarm/rule/ExceptionRule.java
+0
-50
dog-home/src/main/java/com/dianping/dog/alarm/rule/ExceptionRuleTemplate.java
...va/com/dianping/dog/alarm/rule/ExceptionRuleTemplate.java
+0
-8
dog-home/src/main/java/com/dianping/dog/alarm/rule/Rule.java
dog-home/src/main/java/com/dianping/dog/alarm/rule/Rule.java
+11
-5
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleContext.java
...rc/main/java/com/dianping/dog/alarm/rule/RuleContext.java
+0
-13
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleEntityDAO.java
.../main/java/com/dianping/dog/alarm/rule/RuleEntityDAO.java
+0
-39
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleTemplateEntity.java
.../java/com/dianping/dog/alarm/rule/RuleTemplateEntity.java
+0
-57
dog-home/src/main/java/com/dianping/dog/alarm/rule/ServiceRule.java
...rc/main/java/com/dianping/dog/alarm/rule/ServiceRule.java
+0
-25
dog-home/src/main/java/com/dianping/dog/alarm/rule/exception/ExceptionRule.java
.../com/dianping/dog/alarm/rule/exception/ExceptionRule.java
+98
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/exception/ExceptionRuleDef.java
...m/dianping/dog/alarm/rule/exception/ExceptionRuleDef.java
+0
-32
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/ExceptionMessageCreater.java
...nping/dog/alarm/rule/message/ExceptionMessageCreater.java
+14
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/Message.java
...ain/java/com/dianping/dog/alarm/rule/message/Message.java
+5
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/MessageCreater.java
...a/com/dianping/dog/alarm/rule/message/MessageCreater.java
+10
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/MessageCreaterFactory.java
...ianping/dog/alarm/rule/message/MessageCreaterFactory.java
+11
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/Data.java
...src/main/java/com/dianping/dog/alarm/rule/store/Data.java
+9
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/DefaultStorage.java
...ava/com/dianping/dog/alarm/rule/store/DefaultStorage.java
+47
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/ExceptionData.java
...java/com/dianping/dog/alarm/rule/store/ExceptionData.java
+34
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/LinkedStoreQueue.java
...a/com/dianping/dog/alarm/rule/store/LinkedStoreQueue.java
+118
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/Storage.java
.../main/java/com/dianping/dog/alarm/rule/store/Storage.java
+12
-0
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/StoreQueue.java
...in/java/com/dianping/dog/alarm/rule/store/StoreQueue.java
+11
-0
dog-home/src/main/java/com/dianping/dog/alarm/strategy/AlarmStrategy.java
...n/java/com/dianping/dog/alarm/strategy/AlarmStrategy.java
+7
-0
dog-home/src/main/java/com/dianping/dog/alarm/strategy/AlarmStrategyFactory.java
...com/dianping/dog/alarm/strategy/AlarmStrategyFactory.java
+25
-0
dog-home/src/main/java/com/dianping/dog/alarm/strategy/EmailAlarmStrategy.java
...a/com/dianping/dog/alarm/strategy/EmailAlarmStrategy.java
+13
-0
dog-home/src/main/java/com/dianping/dog/alarm/strategy/SmsAlarmStrategy.java
...ava/com/dianping/dog/alarm/strategy/SmsAlarmStrategy.java
+13
-0
dog-home/src/main/java/com/dianping/dog/event/AbstractReactorListener.java
.../java/com/dianping/dog/event/AbstractReactorListener.java
+0
-15
dog-home/src/main/java/com/dianping/dog/event/DefaultEventDispatcher.java
...n/java/com/dianping/dog/event/DefaultEventDispatcher.java
+2
-2
dog-home/src/main/java/com/dianping/dog/event/DefaultEventListenerRegistry.java
.../com/dianping/dog/event/DefaultEventListenerRegistry.java
+7
-8
dog-home/src/main/java/com/dianping/dog/event/EventListener.java
...e/src/main/java/com/dianping/dog/event/EventListener.java
+3
-3
dog-home/src/main/java/com/dianping/dog/event/EventListenerRegistry.java
...in/java/com/dianping/dog/event/EventListenerRegistry.java
+2
-2
dog-home/src/main/java/com/dianping/dog/event/EventType.java
dog-home/src/main/java/com/dianping/dog/event/EventType.java
+3
-2
dog-home/src/test/java/com/dianping/dog/event/EventTest.java
dog-home/src/test/java/com/dianping/dog/event/EventTest.java
+0
-3
dog-home/src/test/java/com/dianping/dog/rule/RuleTest.java
dog-home/src/test/java/com/dianping/dog/rule/RuleTest.java
+0
-10
未找到文件。
dog-home/src/main/java/com/dianping/dog/alarm/alert/AlertEventListener.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.alert
;
import
com.dianping.dog.alarm.problem.AlertEvent
;
import
com.dianping.dog.alarm.rule.message.Message
;
import
com.dianping.dog.alarm.rule.message.MessageCreater
;
import
com.dianping.dog.alarm.rule.message.MessageCreaterFactory
;
import
com.dianping.dog.event.Event
;
import
com.dianping.dog.event.EventListener
;
import
com.dianping.dog.event.EventType
;
import
com.site.lookup.annotation.Inject
;
public
class
AlertEventListener
implements
EventListener
{
@Inject
private
MessageCreaterFactory
factory
;
@Override
public
boolean
isEligible
(
Event
event
)
{
if
(
EventType
.
ProblemAlarmEvent
==
event
.
getEventType
()){
return
true
;
}
return
false
;
}
@Override
public
void
onEvent
(
Event
event
)
{
AlertEvent
alertEvent
=
(
AlertEvent
)
event
;
MessageCreater
messageCreater
=
factory
.
getMessageCreater
(
alertEvent
);
Message
message
=
messageCreater
.
create
(
alertEvent
);
}
}
dog-home/src/main/java/com/dianping/dog/alarm/connector/DataService.java
浏览文件 @
04a524ef
...
...
@@ -60,7 +60,7 @@ public class DataService extends ContainerHolder implements LifeCycle {
continue
;
}
Event
event
=
null
;
if
(
data
.
getType
()
==
EventType
.
ProblemEvent
)
{
if
(
data
.
getType
()
==
EventType
.
Problem
Data
Event
)
{
event
=
new
ProblemEvent
(
data
);
}
if
(
event
!=
null
)
{
...
...
dog-home/src/main/java/com/dianping/dog/alarm/connector/RowData.java
浏览文件 @
04a524ef
...
...
@@ -36,7 +36,7 @@ public class RowData {
public
EventType
getType
()
{
String
type
=
this
.
getData
(
"report"
);
if
(
type
.
equals
(
"problem"
))
{
return
EventType
.
ProblemEvent
;
return
EventType
.
Problem
Data
Event
;
}
return
null
;
}
...
...
dog-home/src/main/java/com/dianping/dog/alarm/data/DataEvent.java
浏览文件 @
04a524ef
...
...
@@ -20,4 +20,5 @@ public interface DataEvent extends Event{
public
long
getTotalCount
();
public
long
getFailCount
();
}
dog-home/src/main/java/com/dianping/dog/alarm/data/TransactionEvent.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.data
;
public
interface
TransactionEvent
extends
DataEvent
{
public
double
getAvg
();
}
dog-home/src/main/java/com/dianping/dog/alarm/entity/Duration.java
浏览文件 @
04a524ef
...
...
@@ -2,13 +2,15 @@ package com.dianping.dog.alarm.entity;
import
java.util.List
;
import
com.dianping.dog.alarm.rule.AlarmType
;
public
class
Duration
{
private
int
min
;
private
int
max
;
private
List
<
Alarm
StrategyEntity
>
strategys
;
private
List
<
Alarm
Type
>
alarmType
;
public
int
getMin
()
{
return
min
;
...
...
@@ -26,12 +28,19 @@ public class Duration {
this
.
max
=
max
;
}
public
List
<
AlarmStrategyEntity
>
getStrategys
()
{
return
strategys
;
public
boolean
isIn
(
int
count
)
{
if
(
min
<=
count
&&
count
<
max
)
{
return
true
;
}
return
false
;
}
public
List
<
AlarmType
>
getAlarmType
()
{
return
alarmType
;
}
public
void
set
Strategys
(
List
<
AlarmStrategyEntity
>
strategys
)
{
this
.
strategys
=
strategys
;
public
void
set
AlarmType
(
List
<
AlarmType
>
alarmType
)
{
this
.
alarmType
=
alarmType
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/entity/RuleEntity.java
浏览文件 @
04a524ef
...
...
@@ -3,7 +3,6 @@ package com.dianping.dog.alarm.entity;
import
java.util.Date
;
import
java.util.List
;
import
com.dianping.dog.alarm.rule.RuleTemplateEntity
;
import
com.site.dal.jdbc.QueryDef
;
/***
...
...
@@ -13,8 +12,6 @@ public class RuleEntity {
public
static
final
QueryDef
DELETE_BY_PK
=
null
;
private
static
String
CONNECT_SOURCE
=
"cat"
;
private
long
id
;
private
String
domain
;
...
...
@@ -29,9 +26,7 @@ public class RuleEntity {
private
ConnectEntity
connect
;
private
long
interval
;
private
RuleTemplateEntity
ruleTemplateEntity
;
private
int
period
;
private
Date
gmtModified
;
...
...
@@ -63,24 +58,12 @@ public class RuleEntity {
this
.
name
=
name
;
}
public
long
getInterval
()
{
if
(
interval
==
0
)
{
interval
=
ruleTemplateEntity
.
getInterval
();
}
return
interval
;
}
public
void
setInterval
(
long
interval
)
{
this
.
interval
=
interval
;
}
public
static
QueryDef
getDeleteByPk
()
{
return
DELETE_BY_PK
;
public
int
getPeriod
()
{
return
period
;
}
public
static
String
getCONNECT_SOURCE
(
)
{
return
CONNECT_SOURCE
;
public
void
setPeriod
(
int
period
)
{
this
.
period
=
period
;
}
public
String
getReportType
()
{
...
...
@@ -88,9 +71,6 @@ public class RuleEntity {
}
public
List
<
Duration
>
getDurations
()
{
if
(
durations
==
null
||
durations
.
size
()
==
0
)
{
durations
=
ruleTemplateEntity
.
getDurations
();
}
return
durations
;
}
...
...
@@ -99,23 +79,9 @@ public class RuleEntity {
}
public
ConnectEntity
getConnect
()
{
connect
=
new
ConnectEntity
();
connect
.
setDomain
(
domain
);
connect
.
setName
(
name
);
connect
.
setType
(
type
);
connect
.
setReport
(
reportType
);
connect
.
setConnectSource
(
CONNECT_SOURCE
);
return
connect
;
}
public
RuleTemplateEntity
getRuleTemplateEntity
()
{
return
ruleTemplateEntity
;
}
public
void
setRuleTemplateEntity
(
RuleTemplateEntity
ruleTemplateEntity
)
{
this
.
ruleTemplateEntity
=
ruleTemplateEntity
;
}
public
Date
getGmtModified
()
{
return
gmtModified
;
}
...
...
dog-home/src/main/java/com/dianping/dog/alarm/filter/ProblemFilterListener.java
浏览文件 @
04a524ef
...
...
@@ -2,14 +2,29 @@ package com.dianping.dog.alarm.filter;
import
com.dianping.dog.alarm.problem.ProblemEvent
;
import
com.dianping.dog.alarm.problem.ProblemViolationEvent
;
import
com.dianping.dog.event.AbstractReactorListener
;
import
com.dianping.dog.event.Event
;
import
com.dianping.dog.event.EventDispatcher
;
import
com.dianping.dog.event.EventListener
;
import
com.dianping.dog.event.EventType
;
import
com.site.lookup.annotation.Inject
;
public
class
ProblemFilterListener
extends
AbstractReactorListener
<
ProblemEvent
>
{
public
class
ProblemFilterListener
implements
EventListener
{
@Inject
protected
EventDispatcher
m_eventdispatcher
;
@Override
public
void
onEvent
(
Problem
Event
event
)
{
ProblemViolationEvent
vEvent
=
new
ProblemViolationEvent
(
event
);
public
void
onEvent
(
Event
event
)
{
ProblemViolationEvent
vEvent
=
new
ProblemViolationEvent
(
(
ProblemEvent
)
event
);
m_eventdispatcher
.
dispatch
(
vEvent
);
}
@Override
public
boolean
isEligible
(
Event
event
)
{
if
(
event
.
getEventType
()
==
EventType
.
ProblemDataEvent
){
return
true
;
}
return
false
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/merge/ProblemMergeListener.java
浏览文件 @
04a524ef
...
...
@@ -8,10 +8,15 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationExce
import
com.dianping.dog.alarm.problem.ProblemEvent
;
import
com.dianping.dog.alarm.rule.Rule
;
import
com.dianping.dog.alarm.rule.RuleManager
;
import
com.dianping.dog.event.AbstractReactorListener
;
import
com.dianping.dog.event.Event
;
import
com.dianping.dog.event.EventDispatcher
;
import
com.dianping.dog.event.EventListener
;
import
com.site.lookup.annotation.Inject
;
public
class
ProblemMergeListener
extends
AbstractReactorListener
<
ProblemEvent
>
implements
Initializable
,
Runnable
{
public
class
ProblemMergeListener
implements
Initializable
,
EventListener
,
Runnable
{
@Inject
protected
EventDispatcher
m_eventdispatcher
;
@Inject
private
DefaultEventQueue
m_defaultEventQueue
;
...
...
@@ -26,6 +31,12 @@ public class ProblemMergeListener extends AbstractReactorListener<ProblemEvent>
private
static
final
long
SLEEP_TIME
=
1
*
1000
;
// sleep for 1 seconds
@Override
public
boolean
isEligible
(
Event
event
)
{
return
true
;
}
@Override
public
void
run
()
{
while
(
isActive
())
{
...
...
@@ -41,15 +52,13 @@ public class ProblemMergeListener extends AbstractReactorListener<ProblemEvent>
}
Thread
.
sleep
(
SLEEP_TIME
);
}
catch
(
InterruptedException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
@Override
public
void
onEvent
(
ProblemEvent
event
)
{
boolean
result
=
m_defaultEventQueue
.
offer
(
event
);
public
void
onEvent
(
Event
event
)
{
boolean
result
=
m_defaultEventQueue
.
offer
((
ProblemEvent
)
event
);
if
(!
result
)
{
// trace queue overflow
m_queueOverflow
++;
if
(
m_queueOverflow
%
1000
==
0
)
{
...
...
@@ -75,5 +84,5 @@ public class ProblemMergeListener extends AbstractReactorListener<ProblemEvent>
serviceTask
=
new
Thread
(
this
,
"ProblemMerge-task"
);
serviceTask
.
start
();
}
}
dog-home/src/main/java/com/dianping/dog/alarm/problem/AlertEvent.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.problem
;
import
java.util.List
;
import
com.dianping.dog.alarm.entity.RuleEntity
;
import
com.dianping.dog.alarm.rule.AlarmType
;
import
com.dianping.dog.event.Event
;
import
com.dianping.dog.event.EventType
;
public
class
AlertEvent
implements
Event
{
private
RuleEntity
entity
;
private
long
time
;
private
List
<
AlarmType
>
typeList
;
private
int
count
;
public
RuleEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
RuleEntity
entity
)
{
this
.
entity
=
entity
;
}
public
long
getTime
()
{
return
time
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
List
<
AlarmType
>
getTypeList
()
{
return
typeList
;
}
public
void
setTypeList
(
List
<
AlarmType
>
typeList
)
{
this
.
typeList
=
typeList
;
}
public
int
getCount
()
{
return
count
;
}
public
void
setCount
(
int
count
)
{
this
.
count
=
count
;
}
@Override
public
EventType
getEventType
()
{
return
EventType
.
ProblemAlarmEvent
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/problem/ProblemEvent.java
浏览文件 @
04a524ef
...
...
@@ -56,7 +56,7 @@ public class ProblemEvent implements DataEvent {
@Override
public
EventType
getEventType
()
{
return
EventType
.
ProblemEvent
;
return
EventType
.
Problem
Data
Event
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/AlarmStrategy.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
public
enum
AlarmStrategy
{
EMAIL
(
"email"
),
SMS
(
"sms"
);
private
String
m_name
;
private
int
m_interval
;
private
AlarmStrategy
(
String
name
)
{
m_name
=
name
;
}
public
AlarmStrategy
setInterval
(
int
interval
)
{
m_interval
=
interval
;
return
this
;
}
public
String
getName
()
{
return
m_name
;
}
public
int
getInterval
()
{
return
m_interval
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/
Level
.java
→
dog-home/src/main/java/com/dianping/dog/alarm/rule/
AlarmType
.java
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule
;
public
enum
Level
{
Level1
,
Level2
,
Level3
public
enum
AlarmType
{
EMAIL
,
SMS
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/DataVistor.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
public
interface
DataVistor
<
T
,
R
>
{
void
visit
(
T
rule
);
R
getResult
();
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/DefaultRuleManager.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.locks.LockSupport
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
public
class
DefaultRuleManager
implements
RuleManager
,
Runnable
,
Initializable
{
private
volatile
boolean
stop
=
false
;
private
List
<
Rule
>
rules
=
new
ArrayList
<
Rule
>();
@Override
public
List
<
Rule
>
getRules
()
{
return
rules
;
}
private
void
reloadAllRules
()
{
}
@Override
public
void
run
()
{
while
(!
stop
)
{
Date
awakeTime
=
nextPeriod
();
LockSupport
.
parkUntil
(
awakeTime
.
getTime
());
reloadAllRules
();
}
}
@Override
public
void
initialize
()
throws
InitializationException
{
reloadAllRules
();
}
private
Date
nextPeriod
()
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
if
(
cal
.
get
(
Calendar
.
MINUTE
)
>
0
)
{
cal
.
add
(
Calendar
.
HOUR
,
1
);
// timeout, waiting for next hour
}
return
cal
.
getTime
();
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/ExceptionRule.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
java.util.List
;
import
com.dianping.dog.alarm.data.DataEvent
;
import
com.dianping.dog.alarm.entity.Duration
;
import
com.dianping.dog.alarm.entity.RuleEntity
;
public
class
ExceptionRule
implements
Rule
{
RuleEntity
m_entity
;
public
ExceptionRule
(
RuleEntity
entity
)
{
m_entity
=
entity
;
}
@Override
public
String
getName
()
{
return
m_entity
.
getName
();
}
@Override
public
boolean
isEligible
(
DataEvent
event
)
{
String
rule_domain
=
m_entity
.
getDomain
();
String
rule_name
=
m_entity
.
getName
();
String
rule_type
=
m_entity
.
getType
();
String
reportType
=
m_entity
.
getReportType
();
String
domain
=
event
.
getDomain
();
if
(!(
domain
==
rule_domain
)){
return
false
;
}
return
true
;
}
@Override
public
boolean
apply
(
DataEvent
event
)
{
List
<
Duration
>
durations
=
m_entity
.
getDurations
();
for
(
Duration
duration
:
durations
)
{
}
return
false
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/ExceptionRuleTemplate.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
//load the template from database
public
class
ExceptionRuleTemplate
{
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/Rule.java
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule
;
import
com.dianping.dog.alarm.data.DataEvent
;
import
com.dianping.dog.alarm.entity.RuleEntity
;
import
com.dianping.dog.event.EventDispatcher
;
public
interface
Rule
{
String
getName
();
boolean
init
(
RuleEntity
entity
);
boolean
isEligible
(
DataEvent
event
);
boolean
apply
(
DataEvent
event
);
public
String
getName
();
public
boolean
isEligible
(
DataEvent
event
);
void
setDispatcher
(
EventDispatcher
dispatcher
);
public
boolean
apply
(
DataEvent
event
);
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleContext.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
com.dianping.dog.alarm.problem.ProblemEvent
;
public
class
RuleContext
{
ProblemEvent
m_event
;
public
RuleContext
(
ProblemEvent
event
){
this
.
m_event
=
event
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleEntityDAO.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
java.util.List
;
import
com.dianping.dog.alarm.entity.RuleEntity
;
import
com.site.dal.jdbc.AbstractDao
;
import
com.site.dal.jdbc.DalException
;
import
com.site.dal.jdbc.Updateset
;
public
class
RuleEntityDAO
extends
AbstractDao
{
public
RuleEntity
createLocal
()
{
RuleEntity
proto
=
new
RuleEntity
();
return
proto
;
}
public
List
<
RuleEntity
>
findAll
(){
return
null
;
}
public
int
deleteByPK
(
RuleEntity
proto
)
throws
DalException
{
return
0
;
}
public
int
updateRuleEntity
(
RuleEntity
proto
,
Updateset
<
RuleEntity
>
updateset
){
return
0
;
}
public
int
insertRuleEntity
(
RuleEntity
ruleEntity
){
return
0
;
}
@Override
protected
Class
<?>[]
getEntityClasses
()
{
return
new
Class
<?>[]
{
RuleEntity
.
class
};
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/RuleTemplateEntity.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
java.util.List
;
import
com.dianping.dog.alarm.entity.Duration
;
public
class
RuleTemplateEntity
{
private
int
ruleTemplateID
;
private
String
templateName
;
private
long
interval
;
private
List
<
Duration
>
durations
;
public
int
getRuleTemplateID
()
{
return
ruleTemplateID
;
}
public
void
setRuleTemplateID
(
int
ruleTemplateID
)
{
this
.
ruleTemplateID
=
ruleTemplateID
;
}
public
String
getTemplateName
()
{
return
templateName
;
}
public
void
setTemplateName
(
String
templateName
)
{
this
.
templateName
=
templateName
;
}
public
long
getInterval
()
{
return
interval
;
}
public
void
setInterval
(
long
interval
)
{
this
.
interval
=
interval
;
}
public
void
addDuration
(
Duration
duration
){
durations
.
add
(
duration
);
}
public
void
deleteDuration
(
Duration
duration
){
durations
.
remove
(
duration
);
}
public
List
<
Duration
>
getDurations
()
{
return
durations
;
}
public
void
setDurations
(
List
<
Duration
>
durations
)
{
this
.
durations
=
durations
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/ServiceRule.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule
;
import
com.dianping.dog.alarm.data.DataEvent
;
public
class
ServiceRule
implements
Rule
{
@Override
public
String
getName
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
boolean
isEligible
(
DataEvent
event
)
{
// TODO Auto-generated method stub
return
false
;
}
@Override
public
boolean
apply
(
DataEvent
event
)
{
// TODO Auto-generated method stub
return
false
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/exception/ExceptionRule.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.exception
;
import
java.util.List
;
import
com.dianping.dog.alarm.data.DataEvent
;
import
com.dianping.dog.alarm.entity.Duration
;
import
com.dianping.dog.alarm.entity.RuleEntity
;
import
com.dianping.dog.alarm.problem.AlertEvent
;
import
com.dianping.dog.alarm.rule.Rule
;
import
com.dianping.dog.alarm.rule.store.Data
;
import
com.dianping.dog.alarm.rule.store.DefaultStorage
;
import
com.dianping.dog.alarm.rule.store.ExceptionData
;
import
com.dianping.dog.alarm.rule.store.Storage
;
import
com.dianping.dog.event.EventDispatcher
;
public
class
ExceptionRule
implements
Rule
{
private
Storage
<
ExceptionData
>
storage
=
null
;
private
EventDispatcher
dispatcher
;
private
static
long
MINUTE
=
60
*
1000L
;
private
long
millisPeriod
=
0
;
private
RuleEntity
m_entity
;
@Override
public
boolean
init
(
RuleEntity
entity
)
{
m_entity
=
entity
;
storage
=
new
DefaultStorage
<
ExceptionData
>();
storage
.
init
(
m_entity
.
getPeriod
());
millisPeriod
=
entity
.
getPeriod
()
*
MINUTE
;
return
true
;
}
@Override
public
String
getName
()
{
return
"Exception rule"
;
}
@Override
public
boolean
isEligible
(
DataEvent
event
)
{
return
false
;
}
@Override
public
boolean
apply
(
DataEvent
event
)
{
saveData
(
event
);
long
currentTime
=
getCurrentTime
();
List
<
ExceptionData
>
dataList
=
storage
.
getDataList
();
int
totalCount
=
0
;
for
(
ExceptionData
data:
dataList
){
if
(!
isIn
(
data
,
currentTime
)){
continue
;
}
totalCount
+=
data
.
getTotalCount
();
}
List
<
Duration
>
durationList
=
m_entity
.
getDurations
();
for
(
Duration
duration
:
durationList
){
if
(
duration
.
isIn
(
totalCount
)){
AlertEvent
alarmEvent
=
new
AlertEvent
();
alarmEvent
.
setEntity
(
m_entity
);
alarmEvent
.
setTime
(
currentTime
);
alarmEvent
.
setTypeList
(
duration
.
getAlarmType
());
alarmEvent
.
setCount
(
totalCount
);
dispatcher
.
dispatch
(
alarmEvent
);
return
true
;
}
}
return
true
;
}
public
void
saveData
(
DataEvent
event
)
{
ExceptionData
data
=
new
ExceptionData
();
data
.
setTimeStamp
(
event
.
getTimestamp
().
getTime
());
data
.
setTotalCount
(
event
.
getTotalCount
());
storage
.
add
(
data
);
}
private
boolean
isIn
(
Data
data
,
long
currentTime
){
long
beginTime
=
currentTime
-
millisPeriod
;
if
(
data
.
getTimeStamp
()
>=
beginTime
&&
data
.
getTimeStamp
()
<=
currentTime
){
return
true
;
}
return
false
;
}
private
long
getCurrentTime
(){
return
System
.
currentTimeMillis
();
}
@Override
public
void
setDispatcher
(
EventDispatcher
dispatcher
)
{
this
.
dispatcher
=
dispatcher
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/exception/ExceptionRuleDef.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.alarm.rule.exception
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.dianping.dog.alarm.rule.AlarmStrategy
;
import
com.dianping.dog.alarm.rule.Level
;
public
class
ExceptionRuleDef
{
private
Map
<
Level
,
List
<
AlarmStrategy
>>
m_alarmStrategies
=
new
HashMap
<
Level
,
List
<
AlarmStrategy
>>();
private
Map
<
Level
,
Integer
>
m_alarmThresholds
=
new
HashMap
<
Level
,
Integer
>();
public
Map
<
Level
,
List
<
AlarmStrategy
>>
getAlarmStrategies
()
{
return
m_alarmStrategies
;
}
public
void
setAlarmStrategies
(
Map
<
Level
,
List
<
AlarmStrategy
>>
alarmStrategies
)
{
m_alarmStrategies
=
alarmStrategies
;
}
public
Map
<
Level
,
Integer
>
getAlarmThresholds
()
{
return
m_alarmThresholds
;
}
public
void
setAlarmThresholds
(
Map
<
Level
,
Integer
>
alarmThresholds
)
{
m_alarmThresholds
=
alarmThresholds
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/ExceptionMessageCreater.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.message
;
import
com.dianping.dog.alarm.problem.AlertEvent
;
public
class
ExceptionMessageCreater
implements
MessageCreater
{
@Override
public
Message
create
(
AlertEvent
event
)
{
return
null
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/Message.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.message
;
public
class
Message
{
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/MessageCreater.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.message
;
import
com.dianping.dog.alarm.problem.AlertEvent
;
public
interface
MessageCreater
{
Message
create
(
AlertEvent
event
);
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/message/MessageCreaterFactory.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.message
;
import
com.dianping.dog.alarm.problem.AlertEvent
;
public
class
MessageCreaterFactory
{
public
MessageCreater
getMessageCreater
(
AlertEvent
event
){
return
new
ExceptionMessageCreater
();
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/Data.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
public
interface
Data
{
long
getTimeStamp
();
Data
merge
(
Data
data
);
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/DefaultStorage.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
public
class
DefaultStorage
<
T
extends
Data
>
implements
Storage
<
T
>
{
private
StoreQueue
<
T
>
queue
;
private
volatile
T
currentData
;
@Override
public
boolean
init
(
int
period
)
{
queue
=
new
LinkedStoreQueue
<
T
>(
period
);
return
true
;
}
@Override
public
synchronized
void
add
(
T
data
)
{
long
timeSpan
=
compare
(
data
.
getTimeStamp
(),
currentData
.
getTimeStamp
());
//TODO need to check the hour and date first!
if
(
timeSpan
==
0
)
{
currentData
.
merge
(
data
);
}
else
if
(
timeSpan
>
0
)
{
queue
.
addData
(
currentData
);
currentData
=
data
;
}
}
@Override
public
List
<
T
>
getDataList
()
{
return
queue
.
getAll
();
}
public
int
compare
(
long
firstStamp
,
long
secondStamp
)
{
int
firstMinute
=
getMinuteOfDay
(
firstStamp
);
int
secondMinute
=
getMinuteOfDay
(
secondStamp
);
return
firstMinute
-
secondMinute
;
}
public
int
getMinuteOfDay
(
long
timestamp
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
(
timestamp
));
return
calendar
.
get
(
Calendar
.
MINUTE
);
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/ExceptionData.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
public
class
ExceptionData
implements
Data
{
private
long
timeStamp
;
private
long
totalCount
;
@Override
public
long
getTimeStamp
()
{
return
timeStamp
;
}
@Override
public
ExceptionData
merge
(
Data
data
)
{
ExceptionData
eData
=
(
ExceptionData
)
data
;
this
.
timeStamp
=
data
.
getTimeStamp
();
this
.
totalCount
+=
eData
.
getTotalCount
();
return
this
;
}
public
long
getTotalCount
()
{
return
totalCount
;
}
public
void
setTotalCount
(
long
totalCount
)
{
this
.
totalCount
=
totalCount
;
}
public
void
setTimeStamp
(
long
timeStamp
)
{
this
.
timeStamp
=
timeStamp
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/LinkedStoreQueue.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.NoSuchElementException
;
import
java.util.concurrent.locks.ReentrantLock
;
public
class
LinkedStoreQueue
<
T
extends
Data
>
extends
ReentrantLock
implements
StoreQueue
<
T
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
volatile
Entry
head
;
private
volatile
Entry
tail
;
private
volatile
int
size
;
private
volatile
int
curSize
;
@SuppressWarnings
(
"unused"
)
private
LinkedStoreQueue
()
{
}
public
LinkedStoreQueue
(
int
size
)
{
this
.
size
=
size
;
this
.
curSize
=
0
;
}
@Override
public
void
addData
(
T
data
)
{
lock
();
try
{
curSize
++;
if
(
curSize
==
size
)
{
removeLast
();
}
if
(
head
==
null
)
{
init
(
data
);
}
else
{
Entry
oldHead
=
head
;
Entry
newHead
=
new
Entry
(
null
,
oldHead
,
data
);
oldHead
.
prev
=
newHead
;
head
=
newHead
;
}
}
finally
{
unlock
();
}
}
private
void
init
(
T
data
)
{
Entry
ctx
=
new
Entry
(
null
,
null
,
data
);
head
=
tail
=
ctx
;
}
private
T
removeLast
()
{
Entry
oldTail
=
tail
;
if
(
oldTail
==
null
)
{
throw
new
NoSuchElementException
();
}
if
(
oldTail
.
prev
==
null
)
{
head
=
tail
=
null
;
}
else
{
oldTail
.
prev
.
next
=
null
;
tail
=
oldTail
.
prev
;
}
return
oldTail
.
getData
();
}
@Override
public
List
<
T
>
getAll
()
{
lock
();
List
<
T
>
dataList
=
new
ArrayList
<
T
>();
try
{
if
(
head
==
null
)
{
throw
new
NullPointerException
(
"data"
);
}
Entry
ctx
=
head
;
for
(;;)
{
dataList
.
add
(
ctx
.
getData
());
ctx
=
ctx
.
next
;
if
(
ctx
==
null
)
{
break
;
}
}
}
finally
{
unlock
();
}
return
dataList
;
}
private
final
class
Entry
{
volatile
Entry
next
;
volatile
Entry
prev
;
private
final
T
data
;
Entry
(
Entry
prev
,
Entry
next
,
T
data
)
{
if
(
data
==
null
)
{
throw
new
NullPointerException
(
"data"
);
}
this
.
prev
=
prev
;
this
.
next
=
next
;
this
.
data
=
data
;
}
T
getData
()
{
return
this
.
data
;
}
}
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/Storage.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
import
java.util.List
;
public
interface
Storage
<
T
>
{
boolean
init
(
int
period
);
void
add
(
T
data
);
List
<
T
>
getDataList
();
}
dog-home/src/main/java/com/dianping/dog/alarm/rule/store/StoreQueue.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.rule.store
;
import
java.util.List
;
public
interface
StoreQueue
<
T
extends
Data
>
{
void
addData
(
T
data
);
List
<
T
>
getAll
();
}
dog-home/src/main/java/com/dianping/dog/alarm/strategy/AlarmStrategy.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.strategy
;
import
com.dianping.dog.alarm.rule.message.Message
;
public
interface
AlarmStrategy
{
boolean
doStrategy
(
Message
message
);
}
dog-home/src/main/java/com/dianping/dog/alarm/strategy/AlarmStrategyFactory.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.strategy
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
com.dianping.dog.alarm.rule.AlarmType
;
public
class
AlarmStrategyFactory
implements
Initializable
{
private
Map
<
AlarmType
,
AlarmStrategy
>
strategyMap
=
null
;
public
AlarmStrategy
getStrategy
(
AlarmType
type
)
{
return
strategyMap
.
get
(
type
);
}
@Override
public
void
initialize
()
throws
InitializationException
{
this
.
strategyMap
=
new
HashMap
<
AlarmType
,
AlarmStrategy
>();
strategyMap
.
put
(
AlarmType
.
EMAIL
,
new
EmailAlarmStrategy
());
strategyMap
.
put
(
AlarmType
.
SMS
,
new
SmsAlarmStrategy
());
}
}
dog-home/src/main/java/com/dianping/dog/alarm/strategy/EmailAlarmStrategy.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.strategy
;
import
com.dianping.dog.alarm.rule.message.Message
;
public
class
EmailAlarmStrategy
implements
AlarmStrategy
{
@Override
public
boolean
doStrategy
(
Message
message
)
{
// TODO Auto-generated method stub
return
false
;
}
}
dog-home/src/main/java/com/dianping/dog/alarm/strategy/SmsAlarmStrategy.java
0 → 100644
浏览文件 @
04a524ef
package
com.dianping.dog.alarm.strategy
;
import
com.dianping.dog.alarm.rule.message.Message
;
public
class
SmsAlarmStrategy
implements
AlarmStrategy
{
@Override
public
boolean
doStrategy
(
Message
message
)
{
// TODO Auto-generated method stub
return
false
;
}
}
dog-home/src/main/java/com/dianping/dog/event/AbstractReactorListener.java
已删除
100644 → 0
浏览文件 @
e046cb85
package
com.dianping.dog.event
;
import
com.site.lookup.annotation.Inject
;
public
abstract
class
AbstractReactorListener
<
T
extends
Event
>
implements
EventListener
<
T
>
{
@Inject
protected
EventDispatcher
m_eventdispatcher
;
@Override
public
boolean
isEligible
(
T
event
)
{
return
true
;
}
}
dog-home/src/main/java/com/dianping/dog/event/DefaultEventDispatcher.java
浏览文件 @
04a524ef
...
...
@@ -10,9 +10,9 @@ public class DefaultEventDispatcher implements EventDispatcher {
@Override
public
void
dispatch
(
Event
event
)
{
List
<
EventListener
<
Event
>
>
listeners
=
m_registry
.
getListeners
();
List
<
EventListener
>
listeners
=
m_registry
.
getListeners
();
if
(
listeners
!=
null
&&
!
listeners
.
isEmpty
())
{
for
(
EventListener
<
Event
>
listener
:
listeners
)
{
for
(
EventListener
listener
:
listeners
)
{
try
{
if
(
listener
.
isEligible
(
event
)){
listener
.
onEvent
(
event
);
...
...
dog-home/src/main/java/com/dianping/dog/event/DefaultEventListenerRegistry.java
浏览文件 @
04a524ef
...
...
@@ -4,24 +4,23 @@ import java.util.ArrayList;
import
java.util.List
;
public
class
DefaultEventListenerRegistry
implements
EventListenerRegistry
{
private
List
<
EventListener
<
Event
>>
m_listeners
=
new
ArrayList
<
EventListener
<
Event
>
>();
private
List
<
EventListener
>
m_listeners
=
new
ArrayList
<
EventListener
>();
@Override
public
synchronized
List
<
EventListener
<
Event
>
>
getListeners
()
{
List
<
EventListener
<
Event
>>
listeners
=
new
ArrayList
<
EventListener
<
Event
>
>();
for
(
EventListener
<
Event
>
listener
:
m_listeners
)
{
public
synchronized
List
<
EventListener
>
getListeners
()
{
List
<
EventListener
>
listeners
=
new
ArrayList
<
EventListener
>();
for
(
EventListener
listener
:
m_listeners
)
{
listeners
.
add
(
listener
);
}
return
listeners
;
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
synchronized
void
register
(
EventListener
<?
extends
Event
>
listener
)
{
public
synchronized
void
register
(
EventListener
listener
)
{
if
(
m_listeners
==
null
)
{
m_listeners
=
new
ArrayList
<
EventListener
<
Event
>
>();
m_listeners
=
new
ArrayList
<
EventListener
>();
}
m_listeners
.
add
((
EventListener
<
Event
>
)
listener
);
m_listeners
.
add
((
EventListener
)
listener
);
}
}
dog-home/src/main/java/com/dianping/dog/event/EventListener.java
浏览文件 @
04a524ef
package
com.dianping.dog.event
;
public
interface
EventListener
<
T
extends
Event
>
{
public
boolean
isEligible
(
T
event
);
public
interface
EventListener
{
public
boolean
isEligible
(
Event
event
);
public
void
onEvent
(
T
event
);
public
void
onEvent
(
Event
event
);
}
dog-home/src/main/java/com/dianping/dog/event/EventListenerRegistry.java
浏览文件 @
04a524ef
...
...
@@ -4,8 +4,8 @@ import java.util.List;
public
interface
EventListenerRegistry
{
public
List
<
EventListener
<
Event
>
>
getListeners
();
public
List
<
EventListener
>
getListeners
();
public
void
register
(
EventListener
<?
extends
Event
>
listener
);
public
void
register
(
EventListener
listener
);
}
dog-home/src/main/java/com/dianping/dog/event/EventType.java
浏览文件 @
04a524ef
...
...
@@ -2,7 +2,8 @@ package com.dianping.dog.event;
public
enum
EventType
{
ProblemEvent
,
ProblemViolationEvent
ProblemDataEvent
,
ProblemViolationEvent
,
ProblemAlarmEvent
,
}
dog-home/src/test/java/com/dianping/dog/event/EventTest.java
浏览文件 @
04a524ef
package
com.dianping.dog.event
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.JUnit4
;
...
...
dog-home/src/test/java/com/dianping/dog/rule/RuleTest.java
浏览文件 @
04a524ef
package
com.dianping.dog.rule
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.JUnit4
;
import
com.dianping.dog.alarm.rule.Rule
;
import
com.dianping.dog.alarm.rule.RuleContext
;
import
com.dianping.dog.event.Event
;
import
com.dianping.dog.event.EventDispatcher
;
import
com.dianping.dog.event.EventListener
;
import
com.dianping.dog.event.EventListenerRegistry
;
import
com.dianping.dog.event.EventType
;
import
com.site.lookup.ComponentTestCase
;
@RunWith
(
JUnit4
.
class
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录