コード例 #1
0
            public static ConcurrentFactory GetConcurrentFactory()
            {
                var f = _ConcurrentFactory;

                if (f == null)
                {
                    lock (_SyncLock)
                    {
                        f = _ConcurrentFactory;
                        if (f == null)
                        {
                            {
                                var modelConfig = new ModelConfig()
                                {
                                    Filenames   = Config.MODEL_FILENAMES,
                                    RowCapacity = Config.MODEL_ROW_CAPACITY,
                                    NGramsType  = Config.MODEL_NGRAMS_TYPE
                                };
                                var model  = new ModelNative(modelConfig);                                //new ModelHalfNative( modelConfig ); //new ModelClassic( modelConfig );
                                var config = new ClassifierConfig(Config.URL_DETECTOR_RESOURCES_XML_FILENAME);

                                f = new ConcurrentFactory(config, model, Config.CONCURRENT_FACTORY_INSTANCE_COUNT);
                                _ConcurrentFactory = f;
                            }
                            {
                                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
                                GC.WaitForPendingFinalizers();
                                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
                            }
                        }
                    }
                }
                return(f);
            }