Esempio n. 1
0
        public MrnActor(IObjectPipe <Job> dp, Queue <Job> workQueue, Action <object> callback)
        {
            _callback = callback;
            if (workQueue == null)
            {
                //Basically, This is a new Node. So make a new work queue
                //and spawn a pair of work threads.
                this._wq = new Queue <Job>();

                //HACK: Hard-coded variable: 2 threads per Node
                int numthreads = 2;

                _threads = new Thread[numthreads];
                for (int i = 0; i < numthreads; i++)
                {
                    _threads[i] = new Thread(this.Worker);
                    _threads[i].Start();
                }
            }
            else
            {
                this._wq = workQueue;
            }

            this._pipe = dp;
        }
Esempio n. 2
0
 protected PipeChannel(IPipelineFilter <TPackageInfo> pipelineFilter, ChannelOptions options)
 {
     _pipelineFilter = pipelineFilter;
     _packagePipe    = new DefaultObjectPipe <TPackageInfo>();
     Options         = options;
     Logger          = options.Logger;
     Out             = options.Out ?? new Pipe();
     In = options.In ?? new Pipe();
 }
Esempio n. 3
0
 public MrmActor(Dictionary <string, Job> waitOn,
                 List <NodeDescription> nStats,
                 Dictionary <string, NodeDescription> nStatsDic,
                 ReaderWriterLockSlim nStatsLock,
                 List <Job> results,
                 IObjectPipe <Job> op)
 {
     _nStats     = nStats;
     _nStatsDic  = nStatsDic;
     _nStatsLock = nStatsLock;
     _op         = op;
     _waitOn     = waitOn;
     _results    = results;
 }
Esempio n. 4
0
        protected PipeChannel(IPipelineFilter <TPackageInfo> pipelineFilter, ChannelOptions options)
        {
            _pipelineFilter = pipelineFilter;

            if (!options.ReadAsDemand)
            {
                _packagePipe = new DefaultObjectPipe <TPackageInfo>();
            }
            else
            {
                _packagePipe = new DefaultObjectPipeWithSupplyControl <TPackageInfo>();
            }

            Options = options;
            Logger  = options.Logger;
            Out     = options.Out ?? new Pipe();
            In      = options.In ?? new Pipe();
        }
Esempio n. 5
0
 public IActor <Job> NewActor(IObjectPipe <Job> op)
 {
     return(new MrmActor(_waitOn, _nStats, _nStatsDic, _nStatsLock, _results, op));
 }
Esempio n. 6
0
 public MrnActor(IObjectPipe <Job> dp, Queue <Job> workQueue) : this(dp, workQueue, null)
 {
 }
Esempio n. 7
0
 public IActor <Job> NewActor(IObjectPipe <Job> dp) => new MrnActor(dp, _wq, _callback);