public DispatcherConfigurator(MessageDispatcherConfigurator configurator, string id, int throughput, long?throughputDeadlineTime) : base(configurator.Config, configurator.Prerequisites) { _configurator = configurator; ThroughputDeadlineTime = throughputDeadlineTime; Id = id; Throughput = throughput; }
/// <summary> /// Used to create a default <see cref="Dispatcher"/> /// </summary> /// <param name="configurator">The configurator used.</param> /// <param name="id">The id of this dispatcher.</param> /// <param name="throughput">The throughput of this dispatcher.</param> /// <param name="throughputDeadlineTime">The deadline for completing N (where N = throughput) operations on the mailbox..</param> /// <param name="executorServiceFactory">The factory for producing the executor who will do the work.</param> /// <param name="shutdownTimeout">The graceful stop timeout period.</param> public Dispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long? throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator) { _executorService = new LazyExecutorServiceDelegate(id, executorServiceFactory); Id = id; Throughput = throughput; ThroughputDeadlineTime = throughputDeadlineTime; ShutdownTimeout = shutdownTimeout; }
/// <summary> /// Used to create a default <see cref="Dispatcher"/> /// </summary> /// <param name="configurator">The configurator used.</param> /// <param name="id">The id of this dispatcher.</param> /// <param name="throughput">The throughput of this dispatcher.</param> /// <param name="throughputDeadlineTime">The deadline for completing N (where N = throughput) operations on the mailbox..</param> /// <param name="executorServiceFactory">The factory for producing the executor who will do the work.</param> /// <param name="shutdownTimeout">The graceful stop timeout period.</param> public Dispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long?throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator) { _executorService = new LazyExecutorServiceDelegate(id, executorServiceFactory); Id = id; Throughput = throughput; ThroughputDeadlineTime = throughputDeadlineTime; ShutdownTimeout = shutdownTimeout; }
public CurrentSynchronizationContextDispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long? throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator, id, throughput, throughputDeadlineTime, executorServiceFactory, shutdownTimeout) { /* * Critical: in order for the CurrentSynchronizationContextExecutor to function properly, it can't be lazily * initialized like all of the others. It has to be executed right away. */ ExecuteTask(new NoTask()); }
/// <summary> /// TBD /// </summary> /// <param name="configurator">TBD</param> /// <param name="id">TBD</param> /// <param name="throughput">TBD</param> /// <param name="throughputDeadlineTime">TBD</param> /// <param name="executorServiceFactory">TBD</param> /// <param name="shutdownTimeout">TBD</param> public CurrentSynchronizationContextDispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long?throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator, id, throughput, throughputDeadlineTime, executorServiceFactory, shutdownTimeout) { /* * Critical: in order for the CurrentSynchronizationContextExecutor to function properly, it can't be lazily * initialized like all of the others. It has to be executed right away. */ ExecuteTask(new NoTask()); }
public void Setup(BenchmarkContext context) { _configurator = Configurator(); _dispatcher = _configurator.Dispatcher(); _dispatcherCounter = context.GetCounter(DispatcherCounterName); ScheduledWork = () => { _dispatcherCounter.Increment(); if (Interlocked.Increment(ref _messagesSeen) == ScheduleCount) { EventBlock.Set(); } }; Warmup(_dispatcher); }
/// <summary> /// Initializes a new instance of the <see cref="SingleThreadDispatcher" /> class. /// </summary> public SingleThreadDispatcher(MessageDispatcherConfigurator configurator) : base(configurator) { var thread = new Thread(_ => { foreach (var next in queue.GetConsumingEnumerable()) { next(); if (!running) { return; } } }); thread.Start(); //thread won't start automatically without this }
public void Setup(BenchmarkContext context) { Sys = ActorSystem.Create("Sys"); Prereqs = new DefaultDispatcherPrerequisites(Sys.EventStream, Sys.Scheduler, Sys.Settings, Sys.Mailboxes); _configurator = Configurator(); _dispatcher = _configurator.Dispatcher(); _dispatcherCounter = context.GetCounter(DispatcherCounterName); ScheduledWork = () => { _dispatcherCounter.Increment(); if (Interlocked.Increment(ref _messagesSeen) == ScheduleCount) { EventBlock.Set(); } }; Warmup(_dispatcher); }
/// <summary> /// Takes a <see cref="MessageDispatcherConfigurator"/> /// </summary> public ThreadPoolDispatcher(MessageDispatcherConfigurator configurator) : base(configurator) { }
/// <summary> /// Takes a <see cref="MessageDispatcherConfigurator"/> /// </summary> public TaskDispatcher(MessageDispatcherConfigurator configurator) : base(configurator) { }
public PinnedDispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long? throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator, id, throughput, throughputDeadlineTime, executorServiceFactory, shutdownTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="MessageDispatcher" /> class. /// </summary> protected MessageDispatcher(MessageDispatcherConfigurator configurator) { Configurator = configurator; Throughput = DefaultThroughput; }
/// <summary> /// Register a <see cref="MessageDispatcherConfigurator"/> that will be used by <see cref="Lookup"/> /// and <see cref="HasDispatcher"/> instead of looking up the configurator from the system /// configuration. /// /// This enables dynamic addition of dispatchers. /// /// <remarks> /// A <see cref="MessageDispatcherConfigurator"/> for a certain id can only be registered once, /// i.e. it can not be replaced. It is safe to call this method multiple times, but only the /// first registration will be used. /// </remarks> /// </summary> /// <returns>This method returns <c>true</c> if the specified configurator was successfully registered.</returns> public bool RegisterConfigurator(string id, MessageDispatcherConfigurator configurator) { return(_dispatcherConfigurators.TryAdd(id, configurator)); }
public CallingThreadDispatcher(MessageDispatcherConfigurator configurator) : base(configurator) { }
internal SingleThreadDispatcher(MessageDispatcherConfigurator configurator, DedicatedThreadPoolSettings settings) : base(configurator) { _dedicatedThreadPool = new DedicatedThreadPool(settings); }
/// <summary> /// TBD /// </summary> /// <param name="configurator">TBD</param> /// <param name="id">TBD</param> /// <param name="throughput">TBD</param> /// <param name="throughputDeadlineTime">TBD</param> /// <param name="executorServiceFactory">TBD</param> /// <param name="shutdownTimeout">TBD</param> public PinnedDispatcher(MessageDispatcherConfigurator configurator, string id, int throughput, long?throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator, id, throughput, throughputDeadlineTime, executorServiceFactory, shutdownTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="MessageDispatcher" /> class. /// </summary> protected MessageDispatcher(MessageDispatcherConfigurator configurator) { Configurator = configurator; Throughput = DefaultThroughput; _shutdownAction = new ShutdownAction(this); }
/// <summary> /// Initializes a new instance of the <see cref="MessageDispatcher" /> class. /// </summary> /// <param name="configurator">TBD</param> protected MessageDispatcher(MessageDispatcherConfigurator configurator) { Configurator = configurator; Throughput = DefaultThroughput; _shutdownAction = new ShutdownAction(this); }
/// <summary> /// Initializes a new instance of the <see cref="CurrentSynchronizationContextDispatcher" /> class. /// </summary> public CurrentSynchronizationContextDispatcher(MessageDispatcherConfigurator configurator) : base(configurator) { _scheduler = TaskScheduler.FromCurrentSynchronizationContext(); }
/// <summary> /// Register a <see cref="MessageDispatcherConfigurator"/> that will be used by <see cref="Lookup"/> /// and <see cref="HasDispatcher"/> instead of looking up the configurator from the system /// configuration. /// /// This enables dynamic addition of dispatchers. /// /// <remarks> /// A <see cref="MessageDispatcherConfigurator"/> for a certain id can only be registered once, /// i.e. it can not be replaced. It is safe to call this method multiple times, but only the /// first registration will be used. /// </remarks> /// </summary> /// <returns>This method returns <c>true</c> if the specified configurator was successfully registered.</returns> public bool RegisterConfigurator(string id, MessageDispatcherConfigurator configurator) { return _dispatcherConfigurators.TryAdd(id, configurator); }
internal ForkJoinDispatcher(MessageDispatcherConfigurator configurator, DedicatedThreadPoolSettings settings) : base(configurator) { _dedicatedThreadPool = new DedicatedThreadPool(settings); }