/** * Thread Safe retrieval of UPAContext * * @return current UPAContext */ public static Net.Vpc.Upa.UPAContext GetContext() /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.UPAContextProvider contextProvider = null; Net.Vpc.Upa.UPAContext context = contextProvider.GetContext(); //Double Checking Lock will/should work here because we are not about to instantiate the object, //this is the responsibility of the contextProvider if (context == null) { lock (typeof(Net.Vpc.Upa.UPAContext)) { context = contextProvider.GetContext(); if (context == null) { Net.Vpc.Upa.ObjectFactory bootstrapFactory = GetBootstrapFactory(); context = bootstrapFactory.CreateObject <Net.Vpc.Upa.UPAContext>(typeof(Net.Vpc.Upa.UPAContext)); context.Start(bootstrapFactory); contextProvider.SetContext(context); } } } return(context); }
public static Net.Vpc.Upa.UPAContextProvider Create() { Net.Vpc.Upa.UPAContextProvider o = Net.Vpc.Upa.UPA.GetBootstrapFactory().CreateObject <Net.Vpc.Upa.UPAContextProvider>(typeof(Net.Vpc.Upa.UPAContextProvider)); Net.Vpc.Upa.UPA.contextProviderCreated = true; return(o); }