Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locking mechanism on data dictionary update
Message
De
23/03/2011 12:18:39
 
 
À
23/03/2011 11:49:01
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01504666
Message ID:
01504687
Vues:
38
>The perfect architecture to support such flexiblity would be to install a double lock mechanism. But, I am afraid of dead locking issue here.

It sounds like updating the data dictionary is not done very often. I assume that all access/updates to the data dictionary is done through this Data class that you mentioned, so you should be able to control it all from there. Something like this might be the way to handle this (sorry, this is going to be in C#, and also un-tested off the top of my head):
// in your method that updates the data dictionary
this.UpdatingDD = true;
lock (lockObjDD)
{
    // do the updating stuff here
}
this.UpdatingDD = false;

// in your method that needs to use the data dictionary
if (this.UpdatingDD == false)
{
    lock (lockObjDD)
    {
        // do your data dictionary stuff here
    }
}
Unfortunately, you probably still have to do the "expensive" lock when you're accessing the data dictionary to prevent the situation where UpdatingDD is false, but a split second later it might be true, so you'll need to lock.

~~Bonnie



>>I'm not sure I quite understand the scenario you've laid out. Could you explain it differently and throw in a bit of code to help clear it up?
>
>When I adjust the data dictionary, this may require to reload an item in the data dictionary collection I have. When doing that, for a fraction of a section, an item in the collection might not be available to an ongoing hit in progress. Because, I have four application pool instances for the Web site, while one hit is updated the data dictionary, another one might still be in progress. Thus, because the Data class makes use of the collection, it may generate an error in the related process. So, the only way I see to resolve that issue would be to verify in the Data class for the availability of the data dictionary. So, when the data dictionary will be in update mode, I will know about it in the Data class and wait for its availability. This, of course, will simply help to diminish to amount of potential situations, but it will probably resolve most of the potential ones. Because, even if the Data class detects that the data dictionary is available, during its process, it might become unavailable again. But, this is unlikely to happen because only one person can update the data dictionary. And, when that happens, it is usually one item at a time, giving the other hits in progress more than enough time to complete.
>
>The perfect architecture to support such flexiblity would be to install a double lock mechanism. But, I am afraid of dead locking issue here.
>
>Any comment on this type of situation?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform