public void setup()
 {
     _dispatcher = Substitute.For<IDispatch<object>>();
     _queue = new InMemoryWorkQueue<object>();
     _subject = new DirectWorkerPool<object>();
     _subject.SetSource(_dispatcher, _queue);
 }
 public SpecificThreadParticipant(IParticipantReference <TRequest, TResponse> func, int threadId, IWorkerPool workerPool, string name)
 {
     _func       = func;
     _threadId   = threadId;
     _workerPool = workerPool;
     _name       = name;
 }
Exemple #3
0
        public void Initialize()
        {
            _xulDeployer.Deploy(_configurationHandler.XulLocation);
            _workers = _poolProvider.Create(_configurationHandler.MinimumWorkerCount, _configurationHandler.MaximumWorkerCount);

            _initialized = true;
        }
Exemple #4
0
 public Actions(IWorkerPool workers, IKanbanBoard board, IStore store, IState state)
 {
     _workers = workers;
     _board   = board;
     _store   = store;
     _state   = state;
 }
Exemple #5
0
        public ParticipantBuilder(IScatterGatherBus messageBus, IWorkerPool workerPool)
        {
            Assert.ArgumentNotNull(messageBus, nameof(messageBus));
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));

            _workerPool   = workerPool;
            _dispatchType = DispatchThreadType.NoPreference;
        }
Exemple #6
0
        public ListenerBuilder(IReqResBus messageBus, IWorkerPool workerPool)
        {
            Assert.ArgumentNotNull(messageBus, nameof(messageBus));
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));

            _messageBus = messageBus;
            _workerPool = workerPool;
        }
        public ThreadPoolThreadSubscription(IWorkerPool workerPool, ISubscriberReference <TPayload> action)
        {
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));
            Assert.ArgumentNotNull(action, nameof(action));

            _workerPool = workerPool;
            _action     = action;
        }
Exemple #8
0
        public static void Initialize(TestContext testContext)
        {
            IWorkerFactory <IWorker> workerFactory = new LocalWorkerFactory();

            _testedPool = FreezerGlobal.Workers;

            _httpServer = new StaticHttpServer(FreezerTestPathSolver.GetDirectory("WebPages"));
        }
        public SpecificThreadPubSubSubscription(ISubscriberReference <TPayload> action, int threadId, IWorkerPool workerPool)
        {
            Assert.ArgumentNotNull(action, nameof(action));
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));

            _action     = action;
            _threadId   = threadId;
            _workerPool = workerPool;
        }
 public void setup()
 {
     _actionCalled = false;
     _dispatcher = Substitute.For<IDispatch<object>>();
     _dispatcher.MaximumInflight().Returns(1);
     _queue = Substitute.For<IWorkQueue<object>>();
     _subject = new ThreadedWorkerPool<object>("name", 1);
     _subject.SetSource(_dispatcher, _queue);
 }
Exemple #11
0
        public ThreadPoolParticipant(IWorkerPool workerPool, IParticipantReference <TRequest, TResponse> action, string name)
        {
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));
            Assert.ArgumentNotNull(action, nameof(action));

            _workerPool = workerPool;
            _action     = action;
            _name       = name;
        }
Exemple #12
0
        public SubscriptionBuilder(IPubSubBus messageBus, IWorkerPool workerPool)
        {
            Assert.ArgumentNotNull(messageBus, nameof(messageBus));
            Assert.ArgumentNotNull(workerPool, nameof(workerPool));

            _dispatchType = DispatchThreadType.NoPreference;
            _workerPool   = workerPool;
            MessageBus    = messageBus;
            Topics        = null;
        }
Exemple #13
0
        private static ISampleWorkFactory GetWorkFactory(bool dummy, IWorkerPool workerPool, WorkAvailableRepo workAvailableRepo)
        {
            if (!dummy)
            {
                return(new ReadFromBlobSampleWorkFactory(
                           () => workerPool.IsAlive, workAvailableRepo));
            }

            return(new DummyWorkFactory(workAvailableRepo));
        }
        public OutboxMonitor(ILogger logger, IWorkerPool workers, int pollDelayMs)
        {
            Assert.ArgumentNotNull(logger, nameof(logger));
            Assert.ArgumentNotNull(workers, nameof(workers));
            Assert.IsInRange(pollDelayMs, nameof(pollDelayMs), 1000, int.MaxValue);

            _outboxes = new ConcurrentDictionary <long, IOutboxSender>();
            var strategy = new OutboxWorkerStrategy(this, pollDelayMs);

            _thread      = new IntervalWorkerThread(logger, strategy);
            _threadToken = workers.RegisterManagedThread("Outbox Module", _thread.ThreadId, "Outbox worker thread");
        }
 public DisposableWorkerPool(IWorkerPool inner, DisposableCollection tokens)
 {
     _inner  = inner;
     _tokens = tokens;
 }
 public void setup()
 {
     _queue = Substitute.For<IWorkQueue<object>>();
     _pool = Substitute.For<IWorkerPool<object>>();
     _pool.PoolSize().Returns(10000);
     _subject = new Dispatch<object>(_queue, _pool);
 }
Exemple #17
0
 public ReadOnlyWorkerPool(IWorkerPool workerPool)
 {
     _workerPool = workerPool;
 }
Exemple #18
0
 public WorkerToken(IWorkerPool workerPool, int threadId)
 {
     _workerPool = workerPool;
     ThreadId    = threadId;
     IsSuccess   = threadId > 0;
 }
Exemple #19
0
        public static IEventLoop CreateEventLoopForTheCurrentThread(IWorkerPool workerPool)
        {
            var context = workerPool.GetCurrentThreadContext();

            return(new EventLoop(context, Thread.CurrentThread.ManagedThreadId));
        }
Exemple #20
0
 public WorkerEngine(Size browserSize, Trigger trigger, CaptureZone captureZone, IWorkerPool <IWorker> workerPool) : base(browserSize, trigger, captureZone)
 {
     _workerPool = workerPool;
 }
Exemple #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SynchronousConsumerEngine{TItem}"/> class.
 /// </summary>
 /// <param name="pool">The pool of workers available to consume the objects.</param>
 /// <param name="runner">The consumer runner which will consume the objects produced.</param>
 public SynchronousConsumerEngine(IWorkerPool pool, IConsumerExecutionStrategy <TItem> runner)
 {
     this.pool   = pool ?? throw new ArgumentNullException(nameof(pool));
     this.runner = runner ?? throw new ArgumentNullException(nameof(runner));
 }
Exemple #22
0
 public State(IWorkerPool workers, IKanbanBoard board, IStore store)
 {
     _workers = workers;
     _board   = board;
     _store   = store;
 }
Exemple #23
0
 public AnyThreadParticipant(IParticipantReference <TRequest, TResponse> func, IWorkerPool workerPool, string name)
 {
     _func       = func;
     _workerPool = workerPool;
     _name       = name;
 }
Exemple #24
0
 public WorkPoolBuilder()
 {
     _workerPool = new WorkerPool();
     _workQueue  = new BlockingCollection <IWorkItem>();
 }
Exemple #25
0
 public Worker(IWorkerPool pool, TcpChannel channel)
 {
     _pool = pool;
     _channel = channel;
 }
Exemple #26
0
 public AnyThreadListener(IListenerReference <TRequest, TResponse> func, IWorkerPool workerPool)
 {
     _func       = func;
     _workerPool = workerPool;
 }
Exemple #27
0
 public WorkerPoolBuilder(IStartupBarrier startupBarrier = null)
 {
     _barrier    = startupBarrier;
     _workerPool = new WorkerPool();
     _workQueue  = new BlockingCollection <IWorkItem>();
 }
 public SubscriptionWithDedicatedWorkerToken(IWorkerPool workerPool, IDisposable subscriptionToken, int threadId)
 {
     _workerToken       = new WorkerToken(workerPool, threadId);
     _subscriptionToken = subscriptionToken;
 }
Exemple #29
0
 internal WorkerPoolBuilder(IWorkerPool workerPool, BlockingCollection <IWorkItem> workQueue)
 {
     _workerPool = workerPool;
     _workQueue  = workQueue;
 }
Exemple #30
0
        public static void Initialize(TestContext testContext)
        {
            IWorkerFactory <IWorker> workerFactory = new LocalWorkerFactory();

            _testedPool = FreezerGlobal.Workers;
        }
Exemple #31
0
 public SpecificThreadListener(IListenerReference <TRequest, TResponse> func, int threadId, IWorkerPool workerPool)
 {
     _func       = func;
     _threadId   = threadId;
     _workerPool = workerPool;
 }