public void Start(CancellationToken token) { log.LogInformation("{LogPrefix}Starting", logPrefix); try { stateConsumer = InitializeStateConsumer(); } catch (Exception e) { log.LogWarning( $"{logPrefix}Error happened during initialization of the global state store; this thread has shutdown : {e}"); throw; } this.token = token; thread.Start(); }
public void Start(CancellationToken token) { log.Info($"{logPrefix}Starting"); try { stateConsumer = InitializeStateConsumer(); } catch { SetState(GlobalThreadState.PENDING_SHUTDOWN); SetState(GlobalThreadState.DEAD); log.Warn($"{logPrefix}Error happened during initialization of the global state store; this thread has shutdown"); throw; } this.token = token; thread.Start(); }
private StateConsumer InitializeStateConsumer() { try { var consumer = new StateConsumer( globalConsumer, globalStateMaintainer, // if poll time is bigger than int allows something is probably wrong anyway new TimeSpan(0, 0, 0, 0, (int)configuration.PollMs), new TimeSpan(0, 0, 0, 0, (int)configuration.CommitIntervalMs)); consumer.Initialize(); return(consumer); } catch (StreamsException) { throw; } catch (Exception e) { throw new StreamsException("Exception caught during initialization of GlobalStreamThread", e); } }