SourcePro Core : Threads Module User's Guide : PART II Concurrency Packages : The Threading Package : Thread Attributes : Querying Threaded Runnables For Thread Creation Attributes
Querying Threaded Runnables For Thread Creation Attributes
The thread attribute instance associated with a threaded runnable can be queried at any time.
getAttribute(): Retrieves a handle to the thread attribute instance, if any, specified during the threaded runnable’s construction or the instance specified in the last call to setAttribute(). If no attribute has ever been specified, this function returns the default attribute instance created when the runnable was constructed.
Because threaded runnables make a local copy of the thread attribute instance during thread creation, the instance returned by this function might not have the same attribute values as were used to create the runnable’s active thread. Use the getActiveAttribute() function to retrieve a copy of the thread attribute instance that actually created the current active thread.
getActiveAttribute(): Gets a handle to a copy of the actual thread attribute instance used to create the runnable’s current active thread. If the threaded runnable has not yet been started, this function returns a copy of a default attribute instance. Once start() has been called, this function returns a copy of the local attribute instance that was saved when the thread was created.
getPoolAttribute(): Retrieves a handle to the pool thread attribute instance, if any, specified during server pool construction or the instance specified in the last call to setPoolAttribute(). If no attribute has ever been specified, this function returns the default attribute instance created when the runnable was constructed.
Because a server pool makes a local copy of the pool thread attribute instance during start-up, this instance might not have the same attribute values as were used to create the threads in the server pool. Use the getActivePoolAttribute() function to retrieve a copy of the thread attribute instance that created the active pool threads.
getActivePoolAttribute(): Gets a handle to a copy of the actual thread attribute instance that created the current server pool threads. If the server pool has not yet been started, this function returns a copy of a default attribute instance. Once start() has been called, this function returns a copy of the attribute instance that was saved when the server was started.