Re: ThreadLocal not serialzable

Jonas BonĂ©r <[email protected]> Wed, 07 May 2003 13:32:58 +0200
Newsgroups gmane.comp.java.aspectwerkz
Message-ID <[email protected]>
Hi Tom.

I have implemented your solution with a custom serializable ThreadLocal 
  class. It works fine for now.
I will ship it along with the next release (within a week).

Sincerely, Jonas.

Tom Miller wrote:

 > 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
 >
 >
 >
 >


-- 
Jonas
http://freeroller.net/page/jboner




-- 
Jonas
http://freeroller.net/page/jboner





-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com