Patent ID: 7941793

Claim:
A computer system comprising a processor operatively coupled to a memory and one or more storage media having stored thereon computer-executable instructions that, when executed by the processor, perform a method for mitigating problems associated with automatic execution of initialization code, the method comprising: determining whether a class has an initializing method comprising class initialization code; determining the execution point at which the initializing method should be called by at least analyzing domain uniqueness information associated with one or more application domains with which the class initialization code will interact, wherein the domain uniqueness information comprises an identifier that identifies whether the initializing method is associated with a “normal” environment, or a “domain neutral” environment, wherein the normal environment is an environment in which the class initialization code needs to initialize one set of static fields and in which multiple application domains share a single state associated with the class, and wherein the domain neutral environment is an environment in which the class initialization code needs to initialize more than one set of static fields and in which each of the multiple application domains have separate corresponding states associated with the class; associating initialization check code with one or more static fields according to a domain associated with at least the class, the check code being operable to determine whether the class is initialized; determining, prior to calling the initialization method, whether calling the initializing method will generate a deadlock, and if calling the initializing method will generate a deadlock, resolving the deadlock; and calling the class initializing method.