public async Task Run() { var ioService = new IoServiceScheduler(); var threadPool = new IoServiceThreadPoolScheduler(ioService); var proxyEngine = new ProxyEngine(threadPool); ILibraryActor library = new LibraryActor(); library = proxyEngine.CreateProxy(library); IResultProcessorActor resultProcessorActor = new PrintTopWordsProcessorActor(); resultProcessorActor = proxyEngine.CreateProxy(resultProcessorActor); ICountWordAggregateActor aggregateWordCountActor = new WordCountAggregateActor(resultProcessorActor, BookLinesParserActor.NUMBER_OF_CONSUMERS); aggregateWordCountActor = proxyEngine.CreateProxy(aggregateWordCountActor); IBookLinesParserActor linesParserActor = new BookLinesParserActor(library, new BookLineConsumerFactory(aggregateWordCountActor, proxyEngine)); linesParserActor = proxyEngine.CreateProxy(linesParserActor); library.AddBook(BOOK_NAME); await linesParserActor.ProcessLastBook().ConfigureAwait(false); linesParserActor.Complete(); await resultProcessorActor.Completed; }
public AsyncPlayerTest() { var ioServiceScheduler = new IoServiceScheduler(); var threadPoolScheduler = new IoServiceThreadPoolScheduler(ioServiceScheduler, 1); var externalProxyScheduler = new ProxyScheduler(threadPoolScheduler); m_proxyEngine = new ProxyEngine(threadPoolScheduler); createActors(); }
private static void runSimpleUploaderActor() { const int NUMBER_OF_THREADS = 1; var ioService = new IoServiceScheduler(); var primaryScheduler = new IoServiceThreadPoolScheduler(ioService, NUMBER_OF_THREADS); var proxyScheduler = new ProxyScheduler(primaryScheduler); var proxyEngine = new ProxyEngine(primaryScheduler); var simpleUploaderActor = new SimpleUploaderActor(); var uploaderActorProxy = proxyEngine.CreateProxy <IService>(simpleUploaderActor); runSimpleUploader(uploaderActorProxy); }
public void Ctor_When_Number_Of_Threads_Is_Negative_Then_Throws_ArgumentOutOfRangeException() { var threadPool = new IoServiceThreadPoolScheduler(m_ioService, -1); }
public void Ctor_When_Io_Service_Is_Null_Then_Throws_ArgumentException() { var threadPool = new IoServiceThreadPoolScheduler(null); }