Пример #1
0
        public override void stop(StopContext context)
        {
            ManagedReference reference = null;

            try
            {
                // get the process application component
                ProcessApplicationInterface processApplication = null;
                ComponentView componentView = paComponentViewInjector.OptionalValue;
                if (componentView != null)
                {
                    reference          = componentView.createInstance();
                    processApplication = (ProcessApplicationInterface)reference.Instance;
                }
                else
                {
                    processApplication = noViewProcessApplication.Value;
                }

                invokePreUndeploy(processApplication);
            }
            catch (Exception e)
            {
                LOGGER.log(Level.SEVERE, "Exception while stopping process application", e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }
        protected override async Task StopAgent(StopContext context)
        {
            LogContext.Debug?.Log("Stopping consumer: {InputAddress}", _context.InputAddress);

            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #3
0
        async Task IAgent.Stop(StopContext context)
        {
            LogContext.Current = DefaultLogContext;

            await _receiveEndpoints.Stop(context).ConfigureAwait(false);

            await base.Stop(context).ConfigureAwait(false);
        }
Пример #4
0
        protected override async Task StopAgent(StopContext context)
        {
            await _limit.WaitAsync(context.CancellationToken).ConfigureAwait(false);

            await base.StopAgent(context).ConfigureAwait(false);

            _limit.Release(1);
        }
Пример #5
0
        async Task IAgent.Stop(StopContext context)
        {
            LogContext.Current = _hostConfiguration.LogContext;

            await ReceiveEndpoints.Stop(context).ConfigureAwait(false);

            await base.Stop(context).ConfigureAwait(false);
        }
Пример #6
0
            protected override async Task StopAgent(StopContext context)
            {
                await _endpoints.Stop(context.CancellationToken).ConfigureAwait(false);

                await _supervisor.Stop(context).ConfigureAwait(false);

                await base.StopAgent(context).ConfigureAwait(false);
            }
Пример #7
0
        protected override async Task StopAgent(StopContext context)
        {
            await base.StopAgent(context).ConfigureAwait(false);

            if (_messageFabric.IsValueCreated)
            {
                await _messageFabric.Value.DisposeAsync().ConfigureAwait(false);
            }
        }
Пример #8
0
        /// <inheritdoc />
        protected override async Task StopAgent(StopContext context)
        {
            if (_contextHandle.Context.Status == TaskStatus.RanToCompletion)
            {
                await _contextHandle.DisposeAsync(context.CancellationToken).ConfigureAwait(false);
            }

            SetCompleted(TaskUtil.Completed);
        }
Пример #9
0
        Task IAgent.Stop(StopContext context)
        {
            if (_host == null)
            {
                throw new InvalidOperationException("The host is not ready.");
            }

            return(_host.Stop(context));
        }
        protected override async Task StopAgent(StopContext context)
        {
            ReceiveEndpoint[] endpoints;
            lock (_mutateLock)
                endpoints = _endpoints.Values.Where(x => _machine.IsStarted(x)).ToArray();

            await Task.WhenAll(endpoints.Select(x => x.Stop(context.CancellationToken))).ConfigureAwait(false);

            await base.StopAgent(context).ConfigureAwait(false);
        }
Пример #11
0
        /// <inheritdoc />
        protected override Task StopAgent(StopContext context)
        {
            IAgent[] agents;
            lock (_agents)
            {
                agents = _agents.Values.Where(x => !x.Completed.IsCompleted).ToArray();
            }

            return(StopSupervisor(new Context(context, agents)));
        }
Пример #12
0
        protected override async Task StopAgent(StopContext context)
        {
            _messageConsumer.Stop();
            _messageConsumer.Listener -= HandleMessage;
            _messageConsumer.Start();

            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #13
0
        protected override async Task StopAgent(StopContext context)
        {
            _channel.Writer.Complete();

            await _channel.Reader.Completion.ConfigureAwait(false);

            await _dispatcher.ConfigureAwait(false);

            await base.StopAgent(context).ConfigureAwait(false);
        }
Пример #14
0
        protected override async Task StopAgent(StopContext context)
        {
            HostReceiveEndpointHandle[] handles;
            lock (_mutateLock)
                handles = _handles.Values.ToArray();

            await Task.WhenAll(handles.Select(x => x.StopAsync(context.CancellationToken))).ConfigureAwait(false);

            await base.StopAgent(context).ConfigureAwait(false);
        }
Пример #15
0
        protected override Task StopAgent(StopContext context)
        {
            foreach (Task <CachedMessageProducer> producer in _cache.GetAll())
            {
                producer.Dispose();
            }

            _cache.Clear();

            return(TaskUtil.Completed);
        }
Пример #16
0
        protected override async Task StopAgent(StopContext context)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Stopping consumer: {0}", _context.InputAddress);
            }

            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #17
0
        protected override async Task StopAgent(StopContext context)
        {
            await _consumerContext.Close().ConfigureAwait(false);

            _consumerContext.ErrorHandler -= HandleKafkaError;

            LogContext.Debug?.Log("Stopping consumer: {InputAddress}", _context.InputAddress);

            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #18
0
            protected override async Task StopAgent(StopContext context)
            {
                LogContext.SetCurrentIfNull(_context.LogContext);

                TransportLogMessages.StoppingReceiveTransport(_context.InputAddress);

                if (_supervisor != null)
                {
                    await _supervisor.Stop(context).ConfigureAwait(false);
                }

                await base.StopAgent(context).ConfigureAwait(false);
            }
Пример #19
0
 async Task ActiveAndActualAgentsCompleted(StopContext context)
 {
     if (_dispatcher.ActiveDispatchCount > 0)
     {
         try
         {
             await _deliveryComplete.Task.OrCanceled(context.CancellationToken).ConfigureAwait(false);
         }
         catch (OperationCanceledException)
         {
             LogContext.Warning?.Log("Stop canceled waiting for message consumers to complete: {InputAddress}", _context.InputAddress);
         }
     }
 }
Пример #20
0
        protected override async Task StopAgent(StopContext context)
        {
            await _processorContext.StopProcessingAsync().ConfigureAwait(false);

            _processorContext.ProcessEvent -= HandleMessage;
            _processorContext.ProcessError -= HandleError;

            await _executor.DisposeAsync().ConfigureAwait(false);

            LogContext.Debug?.Log("Stopping consumer: {InputAddress}", _context.InputAddress);

            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #21
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void stop(final org.jboss.msc.service.StopContext context)
        public virtual void stop(StopContext context)
        {
            context.asynchronous();
            executorInjector.Value.submit(() =>
            {
                try
                {
                    performUndeployment();
                }
                finally
                {
                    context.complete();
                }
            });
        }
Пример #22
0
        /// <inheritdoc />
        public async Task Stop(StopContext context)
        {
            _isStopping = true;
            if (_stopping.IsValueCreated)
            {
                _stopping.Value.Cancel();
            }

            await StopAgent(context).ConfigureAwait(false);

            _isStopped = true;
            if (_stopped.IsValueCreated)
            {
                _stopped.Value.Cancel();
            }
        }
            protected override async Task StopAgent(StopContext context)
            {
                LogContext.SetCurrentIfNull(_context.LogContext);

                var metrics   = _dispatcher.GetMetrics();
                var completed = new ReceiveTransportCompletedEvent(_context.InputAddress, metrics);

                await _context.TransportObservers.Completed(completed).ConfigureAwait(false);

                LogContext.Debug?.Log("Consumer completed {InputAddress}: {DeliveryCount} received, {ConcurrentDeliveryCount} concurrent",
                                      _context.InputAddress, metrics.DeliveryCount, metrics.ConcurrentDeliveryCount);

                _consumerHandle.Disconnect();

                await base.StopAgent(context).ConfigureAwait(false);
            }
Пример #24
0
 async Task ActiveAndActualAgentsCompleted(StopContext context)
 {
     if (_tracker.ActiveDeliveryCount > 0)
     {
         try
         {
             await _deliveryComplete.Task.UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false);
         }
         catch (OperationCanceledException)
         {
             if (_log.IsWarnEnabled)
             {
                 _log.WarnFormat("Stop canceled waiting for message consumers to complete: {0}", _context.InputAddress);
             }
         }
     }
 }
Пример #25
0
 protected internal virtual void stopInternal(StopContext context)
 {
     try
     {
         base.stop(context);
     }
     finally
     {
         try
         {
             processEngine.close();
         }
         catch (Exception e)
         {
             LOGGER.log(Level.SEVERE, "exception while closing process engine", e);
         }
     }
 }
Пример #26
0
        protected override async Task StopAgent(StopContext context)
        {
            var slot = 0;

            try
            {
                for (; slot < _concurrencyLimit; slot++)
                {
                    await _limit.WaitAsync(context.CancellationToken).ConfigureAwait(false);
                }

                await base.StopAgent(context).ConfigureAwait(false);
            }
            finally
            {
                _limit.Release(slot);
            }
        }
Пример #27
0
        public override void stop(StopContext arg0)
        {
            ManagedReference reference = null;

            try
            {
                // get the process application component
                ProcessApplicationInterface processApplication = null;
                ComponentView componentView = paComponentViewInjector.OptionalValue;
                if (componentView != null)
                {
                    reference          = componentView.createInstance();
                    processApplication = (ProcessApplicationInterface)reference.Instance;
                }
                else
                {
                    processApplication = noViewProcessApplication.Value;
                }

                BpmPlatformPlugins        bpmPlatformPlugins = platformPluginsInjector.Value;
                IList <BpmPlatformPlugin> plugins            = bpmPlatformPlugins.Plugins;

                foreach (BpmPlatformPlugin bpmPlatformPlugin in plugins)
                {
                    bpmPlatformPlugin.postProcessApplicationUndeploy(processApplication);
                }
            }
            catch (Exception e)
            {
                LOGGER.log(Level.WARNING, "Exception while invoking BpmPlatformPlugin.postProcessApplicationUndeploy", e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }
Пример #28
0
        protected override async Task StopAgent(StopContext context)
        {
            SetCompleted(ActiveAndActualAgentsCompleted(context));

            await Completed.ConfigureAwait(false);
        }
Пример #29
0
 public virtual void stop(StopContext context)
 {
     // nothing to do
 }
Пример #30
0
 public Context(StopContext context, IAgent[] agents)
 {
     _context = context;
     Agents   = agents;
 }