public static function getInstance()
{
if (self::$instance === null) {
global $threadedFactoryInstance;
if ($threadedFactoryInstance instanceof ThreadedFactory) {
self::$instance = $threadedFactoryInstance;
} else {
new ThreadedFactory();
}
}
return self::$instance;
}