private void Initialize(string domainModelName, int memoryStoreVacuumIntervalInSeconds, ITransactionManager transactionManager, IHyperstoreTrace trace, IStatistics stat) { DebugContract.RequiresNotEmpty(domainModelName); DebugContract.Requires(transactionManager); _trace = trace ?? new EmptyHyperstoreTrace(); _transactionManager = transactionManager; if (memoryStoreVacuumIntervalInSeconds < 0) { memoryStoreVacuumIntervalInSeconds = defaultInterval; } _jobScheduler = new JobScheduler(Vacuum, TimeSpan.FromSeconds(memoryStoreVacuumIntervalInSeconds)); _involvedSlots = PlatformServices.Current.CreateConcurrentQueue <SlotList>(); if (stat == null) { stat = EmptyStatistics.DefaultInstance; } _vaccumCounter = VACUUM_EVICTIONS_THROTTLE; _statAddValue = stat.RegisterCounter("MemoryStore", String.Format("#AddValue {0}", domainModelName), domainModelName, StatisticCounterType.Value); _statGeIGraphNode = stat.RegisterCounter("MemoryStore", String.Format("#GeIGraphNode {0}", domainModelName), domainModelName, StatisticCounterType.Value); _statUpdateValue = stat.RegisterCounter("MemoryStore", String.Format("#UpdateValue {0}", domainModelName), domainModelName, StatisticCounterType.Value); _statRemoveValue = stat.RegisterCounter("MemoryStore", String.Format("#RemoveValue {0}", domainModelName), domainModelName, StatisticCounterType.Value); _statVaccumCount = stat.RegisterCounter("MemoryStore", String.Format("#Vaccum{0}", domainModelName), domainModelName, StatisticCounterType.Value); _statVaccumAverage = stat.RegisterCounter("MemoryStore", String.Format("VaccumAvgTimes{0}", domainModelName), domainModelName, StatisticCounterType.Average); _statVaccumSkipped = stat.RegisterCounter("MemoryStore", String.Format("#VaccumSkipped{0}", domainModelName), domainModelName, StatisticCounterType.Value); }
public UnacknowledgedReliableMessageContainer(ObjectPool <UnacknowledgedReliableMessageContext> messageContextPool) { this.messageContextPool = messageContextPool; pendingQueue = new ConcurrentQueue <UnacknowledgedReliableMessageContext>(); resendQueues = Util.Generate <IQueue <UnacknowledgedReliableMessageContext> >( kResendIntervalsByPriority.Values.Max() + 1, i => new Queue <UnacknowledgedReliableMessageContext>() ); unacknowledgedMessageContextsById = new ConcurrentDictionary <Guid, UnacknowledgedReliableMessageContext>(); }
public ProducerConsumerQueue(int workerCount = 1) { _workerCount = workerCount; _isRunning = true; _concurrentQueue = new ConcurrentQueue <Action>(); _errors = new List <Exception>(); _countdownEvent = new CountdownEvent(workerCount); for (var i = 0; i < workerCount; i++) { new Thread(DoWork).Start(); } }
public void PostConstruct() { EchoSocket = new WebSocket(ECHO_URL); LogQueue = new ConcurrentQueue <string> (); EchoSocket.OnOpen += (sender, e) => LogQueue.Enqueue("0Connected to: " + ECHO_URL); EchoSocket.OnMessage += (sender, e) => LogQueue.Enqueue("1Received: " + e.Data); EchoSocket.OnError += (sender, e) => LogQueue.Enqueue("1Error Occurred"); EchoSocket.OnClose += (sender, e) => LogQueue.Enqueue("2Disconnected With Code: " + e.Code); }
public Parallelize(int numberOfThreads, IConcurrentQueue <ScheduledTask> messages) { _messages = messages; _waitForWork = new List <Wait_for_work <ScheduledTask> >(); for (var i = 0; i < numberOfThreads; i++) { var wfw = new Wait_for_work <ScheduledTask>(_messages, () => { ScheduledTask result; var success = _messages.TryDequeue(out result); return(new Tuple <bool, ScheduledTask>(success, result)); }); wfw.Dequeued += _ => _.ContinueWith(_.Message); _waitForWork.Add(wfw); } }
public Parallelize(int numberOfThreads, IConcurrentQueue<ScheduledTask> messages) { _messages = messages; _waitForWork = new List<Wait_for_work<ScheduledTask>>(); for (var i = 0; i < numberOfThreads; i++) { var wfw = new Wait_for_work<ScheduledTask>(_messages, () => { ScheduledTask result; var success = _messages.TryDequeue(out result); return new Tuple<bool, ScheduledTask>(success, result); }); wfw.Dequeued += _ => _.ContinueWith(_.Message); _waitForWork.Add(wfw); } }
protected IndependentThreadExecutor(IExecutorGroup parent, string threadName, TimeSpan breakoutInterval, IConcurrentQueue <IRunnable> taskQueue) : base(parent) { this.terminationCompletionSource = new TaskCompletionSource(); this.taskQueue = taskQueue; this.preciseBreakoutInterval = PreciseTimeSpan.FromTimeSpan(breakoutInterval); this.scheduler = new ExecutorTaskScheduler(this); this.thread = new Thread(this.Loop); if (string.IsNullOrEmpty(threadName)) { this.thread.Name = DefaultWorkerThreadName; } else { this.thread.Name = threadName; } this.thread.Start(); }
public Chain() { Queue = new FriendlyConcurrentQueue <IRunnable>(); }
internal EventsProcessor(IHyperstore store) { DebugContract.Requires(store); _processes = PlatformServices.Current.CreateConcurrentQueue <ProcessInfo>(); _store = store; }
protected IndependentThreadExecutor(string threadName, TimeSpan breakoutInterval, IConcurrentQueue <IRunnable> taskQueue) : this(null, threadName, breakoutInterval, taskQueue) { }