[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Challenge

On Jun 12, 2007, at 1:58 PM, <hermod.opstvedt@xxxxxxxxx> <hermod.opstvedt@xxxxxxxxx> wrote:


I have a bunch of integration beans that communicate with backend systems. Because these backend systems might be unavailable I was thinking about doing something in the lines of the following in order to avoid crashes or hangs in the integration beans:

use introduction to add som extra attributes to them.
use constructor advice to set these attributes from a common system that is aware of the state of the backend systems and holds informations relevant for the communicatio
use around advice for the backend calls checking the introduced attributes in order to see if the call should proceed.

My question then goes: Is this doable?

Yes, this should be quite straight forward to do, but why do it that complicated ?
May be I am missing some key information here, but would it not be better with a BeforeAdvice that kicks in before any calls crossing system boundaries and make that advice use the monioring system ?
One of the challenges that is not addressed in the solution you outline is what do you when the state of a backend system changes ?
If the attributes is set at construct time on a bean, how do they get updated ?
Using a BeforeAdvice that polls the monitoring system would tackle that situation.

How do I go about getting access to the introduced attribute from the around advice?

If you use introductions I would introduce an Interface and then make a default implementation of that interface. Then you in your advice (sure this is not a before advice btw) you can cast this or target to the introduced interface depending on the pointcut used

As an added flavour: I am contemplating using Glassbox, and then expose the intruduced attributes in the JMX beans so that I could use a JMX console to manage them. Doable?

Dunno about the glassbox part of it, but it sure looks exiting. But exposing any given properties as JMX attributes are pretty straight forward, especially if you are using Spring. see http:// static.springframework.org/spring/docs/2.0.x/reference/jmx.html#jmx- interface-metadata-types

And hehe. then you could introduce the spring jmx annotations.. e.g.

declare annotation : * no.dnbnor.eprogram.services..* : @ManagedResource

(please forgive any syntax errors, done in the mail application this, but it should at least almost work :))


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email.

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
aspectj-users mailing list