ServiceMBeanSupport exposes methods stop, start, create, destroy. These are
implemented to in turn call the ServiceController, which then calls
jbossInternalLifecycle(), which then calls startService(), stopService(), etc.
This means if somebody does a call to "stop", the controller state will be
changed, dependent services will be stopped as well, etc. This is different
than the Microcontainer which treats "stop" as a callback, "stop" will be
called after state is changed.
In JBoss 5.0 some of the state management is handled by the Microcontainer. But
a lot is still handled by the ServiceController.
What I would like to do is if have a POJO such as:
| @Service
| public class MyService {
| public void start() throws Exception { ... }
| public void stop() throws Exception { ... }
| public String getState() { return null; }
| }
|
Currently, start is called by the Microcontainer, before the START controller
state is reached.
If somebody (other than the Microcontainer) calls MyService.stop(), I'd like
AOP to intercept this call and instead call the Microcontainer to handle the
stop transition. I'm a newbie and not sure how to write this AOP declaration in
the -beans.xml. Probably what I will have is an annotation (@Service ?) marking
classes to apply this to.
When I write my Interceptor, how do I know if the Microcontainer is calling me
due to Lifecycle transition, or the call is from "somebody else"?
I'd like to also intercept calls to the method "getState()" and return the
Microcontainer state. Or, I'd like to "inject" state somehow.
| public class MyService {
| @InjectState
| State state;
| public State getState() { return state; }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066409#4066409
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066409
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user