Beispiel #1
0
 public ActiveObject(ILoopsFactory factory, Action <T> action,
                     int capacity,
                     TimeSpan interval = new TimeSpan())
 {
     _loop     = factory.Create(LoopAction, interval);
     _queue    = new BlockingCollection <Message>(new ConcurrentQueue <Message>());
     _action   = action;
     _capacity = capacity;
     _interval = interval;
 }
Beispiel #2
0
 public static IStatefullLoop <T> CreateWith <T>(this ILoopsFactory factory, Action <CancellationToken, T> action, TimeSpan timeout = new TimeSpan())
 {
     return(new StatefullLoop <T>(factory.Create(c => { }, timeout)).Loop(action));
 }
Beispiel #3
0
 public static ActiveObject <Action> CreateInvoker(this ILoopsFactory factory,
                                                   int capacity,
                                                   TimeSpan interval = new TimeSpan())
 {
     return(new ActiveObject <Action>(factory, a => a(), capacity, interval));
 }