[aspectc-user] Need to access Caller to method.

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Wed Jun 16 10:31:19 CEST 2004


Hi Craig,

Craig E. Tull schrieb:
> 
> We have the following problem we would like to solve with AspectC for 
> our presentation at an upcoming conference.
> 
> We have a multi-threaded environment with one service (per type) per 
> thread and multiple clients of the service per thread.
> 
> We have a service locator which registers and locates service by 
> (ServiceName,ServiceThread#) pairs.
> 
> When a client asks the service locator for a service of (ServiceName), 
> we want to return the service with (ServiceName,ClientThread#). i.e. The 
> service for the same thread as the client.
> 
> We are not sure how to access methods/data members of the Client (ie. 
> the caller of the serviceLocator::findService(...) method).
> 
> Is this possible in aspectc? What is the function/context function we 
> should be using?
> 
> We thought it should be that(), but apparently not. In the generated 
> code That and Target are the same type.
> 
> - Craig

I hope that I didn't miss an important fact :-). From my point of view 
you could simply use advice for the *call* to 
serviceLocator::findService(...). Then tjp->that() will point to the 
source and tjp->target() will point to the target object of the call.

Does that help you?

Olaf




More information about the aspectc-user mailing list