|
Service Activator Toolkit
Version 1.0.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The IThreadLocal interface defines an API for storing data on
a per thread basis. This general purpose utility is useful for implementing
multi-threaded applications. An instance of IThreadLocal can be
created using the FactoryUtility singleton.
FactoryUtility utility = FactoryUtility.getInstance(); IThreadLocal threadLocal = utility.createThreadLocal();The API is extremely simple in that thread specific data is stored using the
set(Object) method, and thread specific data is retrieved using
the get() method. The value null will be returned
by the method get() if it is called by a thread before it has
called the method set(Object).
Note: It is important that before a thread stops that it removes its data
from the IThreadLocal by calling set(null).
Failure to do so can result in object retention, preventing the stored
data from being garbage collected. This is both a poor programming practice
and illegal per the OSGi specification.
FactoryUtility| Method Summary | |
Object |
get()
Get the Object for the current thread. |
void |
set(Object value)
Set the Object for the current thread. |
| Method Detail |
public Object get()
Object for the current thread.
Object.public void set(Object value)
Object for the current thread.
value - An Object.
|
Service Activator Toolkit
Version 1.0.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright © 2001, 2007 IBM Corporation and others. All Rights Reserved.