public IRamDB CreateRamDB <T>(string dbName, int preAllocSize = 0) { var retDb = new TestRamDB(); if (!RamDatabase.TryAdd(dbName, retDb)) { //throw new Exception("Database already exists: " + dbName); return(RamDatabase[dbName]); } retDb.Init <T>(); return(retDb); }
/// <summary> /// Constructor /// </summary> /// <param name="threadCount">Number of threads that this CEP will use</param> public Processor(int threadCount, int id) { TimeProvider = new DefaultTimeProvider(); // var update = new TimedUpdated(); JobManager = new SimpleJobManager(); LoggingProvider = new ConsoleLoggingProvider(); ID = id; Threads = new Thread[threadCount]; HistoricalData = new TestRamDB(); ObjectPool = new ObjectPool(); Express2.BlockFactory = CreateBlockFactory(); //ScriptsManager = new ScriptManager(@"..\..\..\Dashx.CoreCEP.Scripts\Scripts"); for (int i = 0; i < threadCount; i++) { Threads[i] = new Thread(ServiceLoop); Threads[i].Name = "CEP Worker " + i; Threads[i].Start(); } Console.WriteLine(" CEPID: {0} - Num Threads: {1}", ID, threadCount); //System.Timers.Timer timer1 = new System.Timers.Timer(); //timer1.Interval = 3000; //timer1.Elapsed += new ElapsedEventHandler(PrintQueueSize); //timer1.Start(); ErrorHandler = (block, exception) => { if (exception is ThreadAbortException) { return(false); } throw new Exception("*****Error in block: " + block.DebugName + " Exception: " + exception.Message); //+ "\n\r--\n\r" + exception.StackTrace); return(true); }; // System.Threading.Timer timer1 = new System.Threading.Timer(PrintQueueSize,null,TimeSpan.FromMilliseconds(0),TimeSpan.FromMilliseconds(1000)); }