Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] flow of execution in different threads

Hello Serge,

Beaumont, Serge ha scritto:

Valerio, I only allowed one overall thread of execution to function
at a time. In the system I tested this meant only one call to the
Websphere server at a time. Then I passed context information from one
thread to the next with a singleton (actually, anything that both threads
can reach will work). Not elegant, but it got the job done.
unfortunatly, since this will be deployed in a system where asyncronous calls are involved, each of them possibly handled by a different thread, i think that i can't apply to that.

If you can use static introduction, you have a better alternative. You use
static introduction to attach context information to the argument objects
that get passed from one thread to another.

i can use them, as far as the semantic of the objects passed by one thread to the other is not changed. (and i think it is my case)

This way you can pass any
information you want across thread borders. Your could for instance
generate a unique number per cflow, and pass that along with your
arguments using static introduction.

so, a single aspect should generate a unique id per cflow: but how can I "label" a cflow pointcut with a ID ? i know i can have named pointcut: are you saying I have to name it with this ID ?

This solution is very close to the
wormhole pattern that you can find in Laddad's AspectJ in Action.
once i found also an article somewhere, but i can't find it anymore. i still don't have that book unfortunaly, but I think i will get it soon.

thanks,
Valerio


Back to the top