Multiton pattern: Difference between revisions

Content deleted Content added
C#: Cleaned up to remove lock by using a ConcurrentDictionary
Action Script 3.0/ Flex: Private contractors are not allowed in AS3. Added allowCreation to overcome this limitation
Line 46:
public class InternalModelLocator {
private static var instances:Dictionary = new Dictionary();
private static var allowCreation:boolean;
 
privatepublic function InternalModelLocator() {
/* Only one instance created with GetInstanceMethod*/
if(!allowCreation){
/* throw new Error("Only one instance aloud to be created, and only with GetInstanceMethod*/");
}
}
/* module_uuid can be a String --------
Line 59 ⟶ 61:
if (instance == null) {
allowCreation = true;
instance = new InternalModelLocator();
allowCreation = false;
instances[module_uuid] = instance;
}