-
Notifications
You must be signed in to change notification settings - Fork 2
struberg/InterDyn
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
JSR-299 Extension for enabling interceptors dynamically
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published