public AsyncConnector( AsyncCluster cluster, AsyncNode node, ConnectorListener listener, SocketAsyncEventArgs args, byte[] buffer ) { this.cluster = cluster; this.node = node; this.listener = listener; this.eventArgs = args; this.eventArgs.UserToken = this; this.dataBuffer = buffer; this.watch = Stopwatch.StartNew(); AsyncTimeoutQueue.Instance.Add(this, cluster.connectionTimeout); this.conn = new AsyncConnection(node.address, node); eventArgs.SetBuffer(dataBuffer, 0, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } }
private void ExecuteCommand() { if (complete != 0) { AlreadyCompleted(complete); return; } try { node = GetNode(); eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { conn = new AsyncConnection(node.address, cluster); eventArgs.SetBuffer(0, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } } catch (AerospikeException.InvalidNode) { if (!RetryOnInit()) { throw; } } catch (AerospikeException.Connection) { if (!RetryOnInit()) { throw; } } catch (SocketException se) { if (!RetryOnInit()) { throw GetAerospikeException(se.SocketErrorCode); } } catch (Exception e) { if (!FailOnApplicationInit()) { throw new AerospikeException(e); } } }
private void ExecuteCommand() { iteration++; try { node = (AsyncNode)GetNode(cluster); node.ValidateErrorCount(); eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { node.IncrAsyncConnTotal(); conn = new AsyncConnection(node.address, node); eventArgs.SetBuffer(segment.buffer, segment.offset, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } ErrorCount = 0; } catch (AerospikeException.Connection aec) { ErrorCount++; ConnectionFailed(aec); } catch (AerospikeException.Backoff aeb) { ErrorCount++; Backoff(aeb); } catch (AerospikeException ae) { ErrorCount++; FailOnApplicationError(ae); } catch (SocketException se) { ErrorCount++; ConnectionFailed(GetAerospikeException(se.SocketErrorCode)); } catch (Exception e) { ErrorCount++; FailOnApplicationError(new AerospikeException(e)); } }
private void ExecuteCommand() { try { node = (AsyncNode)GetNode(); eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { conn = new AsyncConnection(node.address, cluster); eventArgs.SetBuffer(segment.buffer, segment.offset, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } } catch (AerospikeException.Connection) { if (!RetryOnInit()) { throw; } } catch (SocketException se) { if (!RetryOnInit()) { throw GetAerospikeException(se.SocketErrorCode); } } catch (Exception e) { if (!FailOnApplicationInit()) { throw new AerospikeException(e); } } }
private void ExecuteCommand() { iteration++; try { if (partition != null) { node = (AsyncNode)GetNode(cluster, policy, partition, isRead); } eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { conn = new AsyncConnection(node.address, cluster, node); eventArgs.SetBuffer(segment.buffer, segment.offset, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } } catch (AerospikeException.Connection aec) { ConnectionFailed(aec); } catch (SocketException se) { ConnectionFailed(GetAerospikeException(se.SocketErrorCode)); } catch (Exception e) { FailOnApplicationError(new AerospikeException(e)); } }
private void ExecuteCommand() { if (complete != 0) { AlreadyCompleted(complete); return; } try { node = GetNode(); eventArgs.RemoteEndPoint = node.address; conn = node.GetAsyncConnection(); if (conn == null) { conn = new AsyncConnection(node.address, cluster); eventArgs.SetBuffer(segment.buffer, segment.offset, 0); if (!conn.ConnectAsync(eventArgs)) { ConnectionCreated(); } } else { ConnectionReady(); } } catch (AerospikeException.InvalidNode) { failedNodes++; if (!RetryOnInit()) { throw; } } catch (AerospikeException.Connection) { failedConns++; if (!RetryOnInit()) { throw; } } catch (SocketException se) { if (!RetryOnInit()) { throw GetAerospikeException(se.SocketErrorCode); } } catch (Exception e) { if (!FailOnApplicationInit()) { throw new AerospikeException(e); } } }