[ 
https://issues.apache.org/jira/browse/IGNITE-1108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14651861#comment-14651861
 ] 

Vladimir Ozerov commented on IGNITE-1108:
-----------------------------------------

Nick,

Thank you for your contribution to Ignite. Here are my comments:
1) We start components in one order and stop in the opposite. For plugins this 
is true for start(), onAfterStart(), onAfterStop() and onStop() events. That 
is, if there are 2 plugins A and B, and we start A then B, during stop we stop 
B then A. However, this is not true for new onBeforeStart() and onAfterStart() 
callback. We must ensure that start/stop sequence is the same for all events.
2) In IgnitePluginProcessor you do "throw new IgniteCheckedException("Failed to 
stop plugins.");". It seems unnecessary to me as nothing can be done here 
except of logging the error what already happens several lines earlier.
3) You didn't track on which plugins are started and which are not. As a 
result, If you have plugins A and B, A starts first and throws an exception 
from "onBeforeStart()", then onAfterStop() callback still will be invoked on 
both A and B which is wrong. You should follow the same approach as we have in 
IgniteKernal.startProcessor() method: start component and add it to the list. 
During stop invoke stop callbacks only on plugins from the list. 

> Additional lifecycle callbacks in PluginProvider interface.
> -----------------------------------------------------------
>
>                 Key: IGNITE-1108
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1108
>             Project: Ignite
>          Issue Type: Task
>          Components: general
>    Affects Versions: 1.1.4
>            Reporter: Vladimir Ozerov
>            Assignee: Nikolay Tikhonov
>            Priority: Critical
>             Fix For: ignite-1.4
>
>         Attachments: ignite-1108.patch
>
>
> Currently plugins are started at the very end of start process, and they are 
> stopped before all other components.
> This is a problem because sometimes we need to stop plugin AFTER all other 
> components. not BEFORE. E.g. consider a plugin which provides an environment 
> for custom cache store, and this store has "write-behind" enabled. In this 
> case we will stop plugin before write-behind store flushed all data what 
> leads to unexpected behavior.
> It seems that we must provide more callbacks so that plugins could be 
> notified both before and after all other components are started/stopped.
> Proposed design:
> 1) Start:
> - PluginProvider.onBeforeStart() - called from IgnitePluginProcessor.start();
> - PluginProvider.start() - already exists, unchanged;
> - PluginProvider.onAfterStart() - just rename onIgniteStart() for consistency 
> with onBeforeStart();
> 2) Stop procedure is mirrored from start: onBeforeStop(), stop(), 
> onAfterStop().
> 3) Introduce PluginProviderAdapter where methods will be no-op. This way user 
> plugins will continue compile in case of further changes to PluginProvider 
> interfaces provided that method names are unchanged.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to