Class ThreadLocalStorage
public class ThreadLocalStorage
{
// Constructors
public ThreadLocalStorage();
// Methods
protected void finalize();
public Object get();
public void release();
public void set(Object obj);
}
This class allows applications to store a per-thread reference to a Java object.
public ThreadLocalStorage();
Creates a new per-thread storage object for application use.
protected void finalize();
Performs cleanup tasks before garbage collection.
Return Value:
No return value
public Object get();
Retrieves the per-thread object stored in this storage object.
Return Value:
Returns the per-thread object stored in this storage object.
public void release();
Destroys the storage object. The finalize method will perform this task for you, but because storage objects are scarce resources, you should use this method to release them in a timely manner.
Return Value:
No return value.
public void set(Object obj);
Stores a specified per-thread object in the storage object.
Return Value:
No return value.
Parameter | Description |
obj
| The new object to store.
|