Example #1
0
        // Do full initialization (both static and runtime).
        // This can be called multiple times on a config.
        public static async Task <JobHostContext> CreateAndLogHostStartedAsync(
            this JobHostConfiguration config,
            JobHost host,
            CancellationToken shutdownToken,
            CancellationToken cancellationToken)
        {
            JobHostContext context = await config.CreateJobHostContextAsync(host, shutdownToken, cancellationToken);

            return(context);
        }
Example #2
0
        private async Task<JobHostContext> CreateContextAndLogHostStartedAsync(CancellationToken cancellationToken)
        {
            JobHostContext context = await _contextFactory.CreateAndLogHostStartedAsync(_shutdownTokenSource.Token, cancellationToken);

            lock (_contextLock)
            {
                if (_context == null)
                {
                    _context = context;
                    _listener = context.Listener;
                }
            }

            return _context;
        }