org.codehaus.aspectwerkz.util
Class SerializableThreadLocal
java.lang.Object
java.lang.ThreadLocal
org.codehaus.aspectwerkz.util.SerializableThreadLocal
- All Implemented Interfaces:
- Serializable
- public class SerializableThreadLocal
- extends ThreadLocal
- implements Serializable
Extends the java.lang.ThreadLocal
to be able to add additional functionality.
This classes
enhances the base implementation by: making it serializable making it wrap an unwrap the values in a
java.lang.ref.WeakReference
to avoid potential memory leaks
- Author:
- Jonas Bonér
- See Also:
- Serialized Form
Method Summary |
Object |
get()
Overrides the java.lang.ThreadLocal#get() method. |
void |
set(Object value)
Overrides the java.lang.ThreadLoca#set(Object value) method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SerializableThreadLocal
public SerializableThreadLocal()
- Constructor. Simply calls the base class constructor.
get
public Object get()
- Overrides the
java.lang.ThreadLocal#get()
method. Retrieves and returns the value wrapped up in a
java.lang.ref.WeakReference
by the SerializableThreadLocal#set(Object value)
method
- Returns:
- the value wrapped up in a weak reference
set
public void set(Object value)
- Overrides the
java.lang.ThreadLoca#set(Object value)
method. Wraps the value in a
java.lang.ref.WeakReference
before passing it on to the java.lang.ThreadLocal#set(Object
value)
method
- Parameters:
value
- the value that should be wrapped up in a weak reference
Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.