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

Alex Petrov commented on CASSANDRA-12461:
-----------------------------------------

Hi [~acoz]. I have several minor suggestions: 

  * run post-shutdown hooks after setting the mode
  * disallow removing hooks if already in shutdown hook
  * return boolean yielded by `add` of the list
  * currently shutdown hooks will run twice on drained node: once during the 
node drain and second time during the actual shutdown, is that intended / 
known? Should we even run shutdown process for the second time after the node 
is already drained? Or can we use an atomic boolean and ensure exactly one run?
  * it might be possible to avoid syncrhonisation by using atomic boolean 
instead of volatile + syncronised block 

I also suggest working further on fixing [CASSANDRA-12011], since currently it 
results into

{code}
LOGBACK: No context given for 
ch.qos.logback.core.hook.DelayingShutdownHook@5bdd8803
{code}

which in my opinion requires some investigation. I've started reading up on it 
and it seems that,
for instance, Spring Boot is doing it through the context shutdown.

Since logging isn't going to be available for post-shutdown hooks, it'd be hard 
to use them,
as you can not see side-effects.

I've pushed a dirty copy of my suggestions 
[here|https://github.com/ifesdjeen/cassandra/commits/12461-trunk]. It might be 
simpler to look at the code :)

> Add hooks to StorageService shutdown
> ------------------------------------
>
>                 Key: CASSANDRA-12461
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12461
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Anthony Cozzie
>            Assignee: Anthony Cozzie
>         Attachments: 
> 0001-CASSANDRA-12461-add-C-support-for-shutdown-runnables.patch
>
>
> The JVM will usually run shutdown hooks in parallel.  This can lead to 
> synchronization problems between Cassandra, services that depend on it, and 
> services it depends on.  This patch adds some simple support for shutdown 
> hooks to StorageService.
> This should nearly solve CASSANDRA-12011



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

Reply via email to