Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conversion from C# to VB.NET
Message
From
19/04/2013 04:59:09
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01571173
Message ID:
01571457
Views:
44
>>>>>>I don't either - the only thing that I focussed on was from another thread - something like a null reference
>>>>>
>>>>>Yes, that is correct.
>>>>>
>>>>>
>>>>>>So I thought that maybe he was setting the property to null, and afterwards reinitialize it
>>>>>>I have focussed on that - never let the property become null
>>>>>
>>>>>I think the only thing I had to do was to create another line such as this:
>>>>>
>>>>>
>>>>>        ' Data dictionary
>>>>>        Public Tables As New Tables
>>>>>        Public TablesTemp As New Tables
>>>>>
>>>>>
>>>>>...and not create another NameObjectCollectionBase under a different names. Then, from the reload, I clear TablesTemp, reload it and assign it to Tables such as:
>>>>>
>>>>>
>>>>>        ' Load the data dictionary
>>>>>        Public Function LoadDataDictionary() As Boolean
>>>>>
>>>>>            ' Make sure to clear all the tables. As when there is a flag to reload the
>>>>>            ' data dictionary, we need to make sure we reset the collection.
>>>>>            oApp.TablesTemp.Clear()
>>>>>
>>>>>            ' Copy the TablesTemp into Tables
>>>>>            ' This allows a hit in progress to continue as is with this shared oApp object as we used a temporary place holder
>>>>>            ' during its initialization. Otherwise, a hit in progress may end up with an object reference not found. This was
>>>>>            ' happening before as it takes about 1.3 seconds to reload the data dictionary.
>>>>>            oApp.Tables = oApp.TablesTemp
>>>>>
>>>>>            ' Let the framework know that we are done
>>>>>            ' This will only happen at startup as there is no need to turn this off on reload
>>>>>            App.lTables = True
>>>>>
>>>>>            Return True
>>>>>        End Function
>>>>>
>>>>>
>>>>>This is only a partial content of the method. Of course, after the Clear() is all the setup of oApp.TablesTemp.
>>>>>
>>>>>This seems to work on the first hit and all other hits to the same worker process. I just need to find out why the other worker process are not properly working. But, this seems to work. I will confirm later on once I fine tune the reason for the other situation.
>>>>
>>>>
>>>>Yes - but you don't need TablesTemp as a property - if you do so, it will work only once - the second time Tables and TablesTemp will be the same object
>>>>
>>>>Some suggestions - never mind the syntax - it's the idea
>>>>
>>>>
>>>>        ' Data dictionary
>>>>        Public Tables As New Tables
>>>>        ' don't need this - Public TablesTemp 
>>>>
>>>>        ' Load the data dictionary
>>>>        Public Function LoadDataDictionary() As Boolean
>>>>
>>>>          dim tablesTmp as new Tables
>>>>                    
>>>>          'the framework is still using Tables
>>>>
>>>>          ' populate tablesTmp if needed
>>>>
>>>>           oApp.Tables = tablesTmp ' from now on the newer version will be used
>>>>
>>>>                ' Let the framework know that we are done
>>>>            ' This will only happen at startup as there is no need to turn this off on reload
>>>>            App.lTables = True
>>>>
>>>>            Return True
>>>>        End Function
>>>>
>>
>>>I still don't see how this can work reliably. Bottom line is the structure of oApp.Tables can change during the course of a hit.
>>
>>
>>I think he saves a reference to Tables in another object ( oProcess ?)
>>
>>As far as I can see the Cloning attempt was to preserve Tables as it was ( recall Tables.Clone() ) since Tables could change
>>
>>The idea here is (1) Don't clone and (2) If Tables has to change - rebuild it first - then save the new object in Tables
>>
>>So the next time oProcess stores a reference to Tables it will have the lastest version, whilst the references that were stored before (in another oProcess) continue to work with an older version of Tables
>
>Still don't see it. Given this:
       public string[] Tables = new string[] { "One", "Two", "Three" };
>     
>
>        public void UseTables()
>        {
>            foreach (string s in Tables)
>            {
>                //Do something
>                System.Threading.Thread.Sleep(1000);
>            }
>        }
>
>        public void LoadDataDictionary()
>        {
>            string[] tables = new string[]{"One","Two"};
>            Tables = tables;
>        }
>
If, for example, LoadDataDictionary() runs on one thread whilst UseTables() is running on another you've got problems...


Can you explain ?
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform