Skip to main content

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

Hi

Using a before advice won't do it as far as I can tell. The only way to change the return value (say return null f.ex.), or throw something like a ResourceUnavailable exception would be in a around advice. Using a before advice won't stop the actual call (or will it?).

My plan is to set the values for the introduced attributes when the class (with the introduced attribute) is constructed. Since they only live for the length of the request, and for the length of the session, that's good enough.

I'll look into the Spring JMX stuff, thnx.

Hermod

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Kaare Nilsen
Sent: Tuesday, June 12, 2007 2:59 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Challenge


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

> Hi
>
> 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 :))

>
> Hermod
>
>
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
> * * * *
>
> 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
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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.

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


Back to the top