protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket) { this.owner = owner; this.endpoint = endpoint; this.socket = socket; this.failurePolicy = failurePolicy; this.name = endpoint.ToString(); failLock = new Object(); writeQueue = new ConcurrentQueue<Data>(); readQueue = new Queue<Data>(); mustReconnect = true; IsAlive = true; counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds); counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds); counterOpReadPerSec = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds); counterWriteQueue = Metrics.Counter("write queue length", endpoint.ToString()); counterReadQueue = Metrics.Counter("read queue length", endpoint.ToString()); counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds); counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds); counterItemCount = Metrics.Counter("commands", endpoint.ToString()); gaugeSendSpeed = Metrics.Gauge("send speed", endpoint.ToString()); }
protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket) { this.owner = owner; this.endpoint = endpoint; this.socket = socket; this.failurePolicy = failurePolicy; this.name = endpoint.ToString(); failLock = new Object(); writeQueue = new ConcurrentQueue <Data>(); readQueue = new Queue <Data>(); mustReconnect = true; IsAlive = true; counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds); counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds); counterOpReadPerSec = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds); counterWriteQueue = Metrics.Counter("write queue length", endpoint.ToString()); counterReadQueue = Metrics.Counter("read queue length", endpoint.ToString()); counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds); counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds); counterItemCount = Metrics.Counter("commands", endpoint.ToString()); gaugeSendSpeed = Metrics.Gauge("send speed", endpoint.ToString()); }
public MessageContextProcessor( Func <Message, CancellationToken, Task> processMessage, IFailurePolicy failurePolicy = null, Func <Exception, bool> shouldComplete = null) : this(new DefaultMessageProcessor(processMessage), failurePolicy, shouldComplete) { }
public void Init() { _messageReceiver = Substitute.For <IMessageReceiver>(); _messageSender = Substitute.For <IMessageSender>(); _failurePolicy = Substitute.For <IFailurePolicy>(); _messageProcessor = Substitute.For <IMessageProcessor>(); _sut = new MessageContextProcessor(_messageProcessor, _failurePolicy, e => e is InvalidOperationException); }
public void Init() { _messageReceiver = Substitute.For <IMessageReceiver>(); _messageSender = Substitute.For <IMessageSender>(); _failurePolicy = Substitute.For <IFailurePolicy>(); _messageProcessor = Substitute.For <IMessageProcessor>(); _sut = new MessageContextProcessor(_messageProcessor, _failurePolicy); }
public MemcachedCluster(IEnumerable<IPEndPoint> endpoints, IBufferAllocator allocator, INodeLocator locator, IReconnectPolicy reconnectPolicy, IFailurePolicy failurePolicy, Func<ISocket> socketFactory) : base(endpoints, locator, reconnectPolicy) { this.allocator = allocator; this.failurePolicy = failurePolicy; this.socketFactory = socketFactory; }
public MessageContextProcessor( IMessageProcessor messageProcessor, IFailurePolicy failurePolicy = null, Func <Exception, bool> shouldComplete = null) { _messageProcessor = messageProcessor ?? throw new ArgumentNullException(nameof(messageProcessor)); _failurePolicy = failurePolicy ?? new AbandonMessageFailurePolicy(); _shouldComplete = shouldComplete; }
public MemcachedCluster(IEnumerable <IPEndPoint> endpoints, IBufferAllocator allocator, INodeLocator locator, IReconnectPolicy reconnectPolicy, IFailurePolicy failurePolicy, Func <ISocket> socketFactory) : base(endpoints, locator, reconnectPolicy) { this.allocator = allocator; this.failurePolicy = failurePolicy; this.socketFactory = socketFactory; }
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); }
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); }
/// <summary> /// /// </summary> /// <param name="messageProcessor"></param> /// <param name="failurePolicy"></param> public MessageContextProcessor(IMessageProcessor messageProcessor, IFailurePolicy failurePolicy = null) { _messageProcessor = messageProcessor ?? throw new ArgumentNullException(nameof(messageProcessor)); _failurePolicy = failurePolicy ?? new AbandonMessageFailurePolicy(); }
public MemcachedNode(IBufferAllocator allocator, ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket) : base(owner, endpoint, failurePolicy, socket) { this.allocator = allocator; }
public void Init() { _sut = new DeferMessageFailurePolicy(ex => true); }
public void Init() { _sut = new CloneMessageFailurePolicy(ex => ex is InvalidOperationException); }
public void Init() { _sut = new AbandonMessageFailurePolicy(); }