-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
88 lines (60 loc) · 3.39 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
JSR-299 Extension for enabling Interceptors Dynamically
General
----------
InterDyn is a JSR-299 (CDI - Context and Dependency Injection for Java)
Extension which allows adding Interceptors to CDI beans without having
to put any extra annotation into the code.
InvoMon is a simple CDI Interceptor which counts invocations of CDI beans
and outputs the top results at the end of each request.
Building
----------
$> mvn clean install
InterDyn Usage
----------
Just place this jar into your classpath and add a
configuration for it by creating a file
META-INF/struct/interdyn.properties
which contains something like the following content
# start of interdyn.properties
enabled=true
rule.1.match=.*ServiceImpl
rule.1.interceptor=net.struberg.devtools.cdi.invomon.InvocationMonitored
rule.2.match=net.struberg.devtools.cdi.interdyn.test.domainobjects.*
rule.2.interceptor=TestInterceptorAnnotation
# end of interdyn.properties
The match section contains the reg exp of the classes which should get intercepted
and the interceptor section contains the name of the interceptor BindingType
annotation.
Invocation Monitor example
--------------------------
This is a fully functional (but still rudimentary) logging Interceptor which
can be used by InterDyn. It will count all your observed class and
method invocations and also take the duration period.
The top values will be logged (Level.INFO) at the end of each servlet request.
Configuration
-------------
The maximum numbers of log lines might be configured with a system property:
-DMAX_LOG_LINES=15
Example
-------
A sample output looks like the following:
2011-03-19 12:36:27,291 [2046767960@qtp-1243908618-9] INFO invomon.InvocationResultLogger Top Class Invocations:
count: 51 net.struberg.myproject.core.be.semester.SemesterRemoteServiceImpl
count: 21 net.struberg.myproject.core.be.security.service.SecurityServiceImpl
count: 5 net.struberg.myproject.util.be.config.ConfigServiceImpl
count: 2 net.struberg.myproject.course.be.CourseServiceImpl
count: 1 net.struberg.myproject.events.be.EventServiceImpl
count: 1 net.struberg.myproject.core.be.persons.PersonRemoteServiceImpl
count: 1 net.struberg.myproject.course.be.LecturerServiceImpl
count: 1 net.struberg.myproject.events.be.EventRemoteServiceImpl
2011-03-19 12:36:27,292 [2046767960@qtp-1243908618-9] INFO invomon.InvocationResultLogger Top Method Invocations:
dur[ms]: 442.48096 count: 1 net.struberg.myproject.course.be.CourseServiceImpl#deleteCourse
dur[ms]: 349.34717 count: 1 net.struberg.myproject.course.be.CourseServiceImpl#getByFilter
dur[ms]: 104.53423 count: 1 net.struberg.myproject.events.be.EventRemoteServiceImpl#getEvent
dur[ms]: 100.43162 count: 1 net.struberg.myproject.events.be.EventServiceImpl#getEvent
dur[ms]: 24.677048 count: 1 net.struberg.myproject.course.be.LecturerServiceImpl#getEmployeeIdsInvolvedInOrgUnitCourses
dur[ms]: 1.596834 count: 1 net.struberg.myproject.core.be.persons.PersonRemoteServiceImpl#getByEmployeeIdList
dur[ms]: 0.892522 count: 51 net.struberg.myproject.core.be.semester.SemesterRemoteServiceImpl#getCorrespondingSemesterCode
dur[ms]: 0.288455 count: 5 net.struberg.myproject.util.be.config.ConfigServiceImpl#getStringProperty
dur[ms]: 0.248038 count: 3 net.struberg.myproject.core.be.security.service.SecurityServiceImpl#isGranted
dur[ms]: 0.203102 count: 18 net.struberg.myproject.core.be.security.service.SecurityServiceImpl#isAuthenticated