public static CreateConnection ( Role role, |
||
role | Role | |
socketAddress | ||
poolSize | int | |
upstreamHandler | IChannelHandler | |
return | Task |
public Controller(int initialParticipants, INode controllerPort) { _connection = RemoteConnection.CreateConnection(Role.Server, controllerPort, _settings.ServerSocketWorkerPoolSize, new ConductorHandler(Self, Logging.GetLogger(Context.System, typeof(ConductorHandler)))); _barrier = Context.ActorOf(Props.Create <BarrierCoordinator>(), "barriers"); _initialParticipants = initialParticipants; }
public Controller(int initialParticipants, IPEndPoint controllerPort) { _log.Debug("Opening connection"); _connection = RemoteConnection.CreateConnection(Role.Server, controllerPort, _settings.ServerSocketWorkerPoolSize, new ConductorHandler(Self, Logging.GetLogger(Context.System, typeof(ConductorHandler)))).Result; _log.Debug("Connection bound"); _barrier = Context.ActorOf(Props.Create <BarrierCoordinator>(), "barriers"); _initialParticipants = initialParticipants; }
private void Reconnect() { _log.Debug("Connecting..."); _nextAttempt = Deadline.Now + _backoff; RemoteConnection.CreateConnection(Role.Client, _server, _poolSize, this).ContinueWith(tr => { _log.Debug("Failed to connect.... Retrying again in {0}s. {1} attemps left.", _nextAttempt.TimeLeft, _reconnects); if (_reconnects > 0) { _reconnects -= 1; if (_nextAttempt.IsOverdue) { Reconnect(); } else { _scheduler.Advanced.ScheduleOnce(_nextAttempt.TimeLeft, Reconnect); } } }, TaskContinuationOptions.NotOnRanToCompletion); }
private void Reconnect() { _nextAttempt = Deadline.Now + _backoff; RemoteConnection.CreateConnection(Role.Client, _server, _poolSize, this); }