Re: ThreadLocal not serialzable

Tom Miller <[email protected]> Sat, 03 May 2003 23:38:52 -0500
Newsgroups gmane.comp.java.aspectwerkz
Organization MAI
Message-ID <[email protected]>
I did some thinking, read up some more on serialization, and read a 
little more of the AspectWerkz source code. I discovered the 
'threadSafe="false"' attribute in <pointcut/> in one of the tests 
(although I'm not clear whether that is appropriate with a perInstance 
or perThread demployment model).

So I tried using that, but now I'm getting:
java.io.NotSerializableException: java.lang.reflect.Method
presumably because the joinpoints are now "MemberMethodJoinPoint" 
objects which contain java.lang.reflect.Method objects (not serializable).

I've been thinking perhaps I should extend java.lang.reflect.Method, or 
java.lang.ThreadLocal, and make it implement Serializable.

But of course I'm open to any better advice.

Thanks
Tom

Tom Miller wrote:

> Being my first post to this list, let me congratulate Jonas on a great 
>  framework! AspectWerkz is very nice to work with, and well thought 
> out. I've been dinking around with the 0.4 examples and having some 
> fair success with my own stuff. Although I've read a little, and have 
> been to an AspectJ seminar, this is the first AOP programming I've 
> done, and I like it very much.
>
> I've been working on a Prevayler-enabled persistence project which I'm 
> aspectizing with AW. Looking at the decompiled persistent classes, I 
> see that all of my setter functions, which have been given an Advice, 
> have java.lang.ThreadLocal objects created for them. When Prevayler 
> attempts to serialize these objects, I get a
> java.io.NotSerializableException: java.lang.ThreadLocal
>
> I hope there is some obvious solution which I'm just not seeing yet. 
> Any ideas?
>
> TIA


-- 
Tom Miller
Miller Associates, Inc.
[email protected]
641.469.3535 Phone
413.581.6326 FAX




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf