Skip to main content

Doubt in CallerContext

1 reply [Last post]
ramks
Offline
Joined: 2010-06-17
Points: 0

Are the runnables posted in runInContext, runInContextSync, runInContextAsync run in threads created in thread pool? Do the application context and system context share the thread pool or do they have seperate pools?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
greg80303
Offline
Joined: 2008-07-03
Points: 0

Today, there is only a single thread pool used to handle both System and Application runInContext requests. We use a combination of Thread Local Storage and ThreadGroups to "disguise" one of these threads as being associated with an application (or with the system).

I have a task on my plate for the 1.2 release (release date not yet established) to revisit this design due to a bug that was brought to our attention last year (IssueTracker 109). I have already implemented an initial version of a new design which uses separate threads pools for the system and for each application. The implementation is maintained in a separate branch:

https://community.cablelabs.com/svn/OCAPRI/branches/threading

My current design uses pools with a static thread count (with a configurable number of threads). I have only tested simple applications with this implementation. I haven't gotten around to the guides yet. My next thought was to implement an algorithm in which individual thread pools would be allowed to grow when needed and then a watchdog thread would observe all of the thread pools and reduce their sizes when their average usage goes down.

G