Exemple #1
0
        public static void StopSafe(
            AgentInstanceStopCallback stopMethod,
            AgentInstanceContext agentInstanceContext)
        {
            var stopServices = new AgentInstanceStopServices(agentInstanceContext);

            var additionalTerminations = agentInstanceContext.TerminationCallbackRO;
            foreach (var stop in additionalTerminations) {
                try {
                    stop.Stop(stopServices);
                }
                catch (EPException) {
                    throw;
                }
                catch (Exception e) {
                    HandleStopException(e, agentInstanceContext);
                }
            }

            try {
                stopMethod.Stop(stopServices);
            }
            catch (EPException) {
                throw;
            }
            catch (Exception e) {
                HandleStopException(e, agentInstanceContext);
            }
        }