[ https://issues.apache.org/jira/browse/FLUME-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15778242#comment-15778242 ]
ASF GitHub Bot commented on FLUME-2894: --------------------------------------- GitHub user laxman-ch opened a pull request: https://github.com/apache/flume/pull/101 FLUME-2894: Fix flume components shutdown order You can merge this pull request into a Git repository by running: $ git pull https://github.com/laxman-ch/flume FLUME-2894 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flume/pull/101.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #101 ---- commit 6acf6e02dbae4e8c00578255f2c7608504e9871d Author: laxman <laxman@ubuntu> Date: 2016-12-26T12:22:50Z FLUME-2894: Fix flume components shutdown order ---- > Flume components should stop in the correct order (graceful shutdown) > --------------------------------------------------------------------- > > Key: FLUME-2894 > URL: https://issues.apache.org/jira/browse/FLUME-2894 > Project: Flume > Issue Type: Bug > Components: Channel, Node, Sinks+Sources > Affects Versions: v1.6.0 > Reporter: Piotr Wiecek > Assignee: Laxman > > Flume components should be stopped in the right way: > * stop the sources (in order to not receiving further notifications), > * wait until all events within the channels are consumed by the sinks, > * stop the channels and the sinks. > Currently, the shutdown hook stops the components in a random manner. > E.g.: SINK, CHANNEL, SOURCE. > Components are stored in the HashMap: > {code:borderStyle=solid} > Map<LifecycleAware, Supervisoree> supervisedProcesses; > ... > supervisedProcesses = new HashMap<LifecycleAware, Supervisoree>(); > ... > @Override > public synchronized void stop() { > ... > for (final Entry<LifecycleAware, Supervisoree> entry : supervisedProcesses > .entrySet()) { > if (entry.getKey().getLifecycleState().equals(LifecycleState.START)) { > entry.getValue().status.desiredState = LifecycleState.STOP; > entry.getKey().stop(); > } > } > .... > {code} > The problems which we can have: > * not all Events will be consumed (Sink will be stopped first) > * Source will continue to accept messages even though other components are > stopped -- This message was sent by Atlassian JIRA (v6.3.4#6332)