|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Context/ThreadLocal data
I am writing a few java methods, and I want to keep track of some information ( objects ) that is unique to each extender that connects. I am assuming this is related to the age old problem of the context.. I have tried using ThreadLocal variables, and they seem to work in none UI widgets, but it seems the UI widget must be executing in another thread so they don't have access to that data. For example, if i do a DebugLog() and print the results of a method that is returning a ThreadLocal variable, it works fine, but if you use the same method to display on the screen, it returns null. Does anyone know if this is how it is working or how to store data specific to a context?
Thanks, Jeff |
#2
|
||||
|
||||
Seems like the most straightforward approach would be to avoid static methods and create a new instance of your class for each running client. Use AddGlobalContext() to store your instance in a global variable specific to that client, and check that variable for null in the Main Menu's BeforeMenuLoad hook to see if it's been initialized yet. Then pass the instance in to your class method calls. That's how classes and objects are meant to work, so why not use them that way?
__________________
-- Greg |
#3
|
|||
|
|||
I was trying to avoid having to pass the object reference in on the STV code for each method call. A majority of the code is shared between all connection so the server so i used static calls to reference the instantiated objects, but I have a few bits of data that I needed specifiy to that clients connection. I guess I will do that if I can't find away around it..
Thanks, Jeff |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Zap2It & SageTV: Built-in data not affected; Alternatives for EPG data not included? | Opus4 | SageTV EPG Service | 20 | 08-21-2008 06:31 PM |
Help with accessing Variables and variable Context. | stanger89 | SageTV Studio | 6 | 11-01-2006 09:38 AM |
Obtaining correct UI context | dflachbart | SageTV Studio | 3 | 07-17-2006 07:10 AM |
EPG list change based on user's context | jtt88 | SageTV Customizations | 0 | 06-16-2004 02:16 PM |