Ejemplo n.º 1
0
        protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
        {
            this.owner         = owner;
            this.endpoint      = endpoint;
            this.socket        = socket;
            this.failurePolicy = failurePolicy;

            name       = endpoint.ToString();
            failLock   = new Object();
            writeQueue = new ConcurrentQueue <OpQueueEntry>();
            readQueue  = new Queue <OpQueueEntry>();

            mustReconnect = true;
            IsAlive       = true;

            npm = new NodePerformanceMonitor(name);
        }
Ejemplo n.º 2
0
        protected NodeBase(ICluster owner, IPEndPoint endpoint, ISocket socket, IFailurePolicyFactory failurePolicyFactory)
        {
            this.owner    = owner ?? throw new ArgumentNullException(nameof(owner));
            this.endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
            this.socket   = socket;

            name       = endpoint.ToString();
            failLock   = new object();
            writeQueue = new ConcurrentQueue <OpQueueEntry>();
            readQueue  = new Queue <OpQueueEntry>();

            IsAlive       = true;
            mustReconnect = true;

            flushWriteBufferAction  = FlushWriteBufferRequest;
            tryAskForMoreDataAction = TryAskForMoreDataRequest;
            failurePolicy           = (failurePolicyFactory ?? throw new ArgumentNullException(nameof(failurePolicyFactory))).Create(this);

            npm = new NodePerformanceMonitor(name);
        }