You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Robert Stupp (JIRA)" <ji...@apache.org> on 2014/07/24 13:46:39 UTC

[jira] [Comment Edited] (CASSANDRA-7597) System.exit() calls should be removed from DatabaseDescriptor

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

Robert Stupp edited comment on CASSANDRA-7597 at 7/24/14 11:46 AM:
-------------------------------------------------------------------

Oops - not that easy. A static initializer in DatabaseDescriptor loads & applies the config and calls System.exit on failure.

I implemented a workaround for these usecases and left the default behavior untouched. "Workaround" as implemented in the attached patch:
# Call {{org.apache.cassandra.config.Config.setIsExitOnInvalidConfig(false)}}
# Check the return value of {{org.apache.cassandra.config.DatabaseDescriptor.getInvalidConfigFailure()}}  - it returns {{null}} if the config has been successfully applied - otherwise it returns the failure.

Also changed the {{catch (Exception e)}} to {{catch (Throwable e)}} in the static initializer to catch really everything - even runtime exceptions.

This is not a good thing and I'm not sure whether to commit this one. [~benedict] ? 


was (Author: snazy):
Oops - not that easy. A static initializer in DatabaseDescriptor loads & applies the config and calls System.exit on failure.

I implemented a workaround for these usecases and left the default behavior untouched. "Workaround" as implemented in the attached patch:
# Call {{org.apache.cassandra.config.Config.setIsExitOnInvalidConfig(false)}}
# Check the return value of {{org.apache.cassandra.config.DatabaseDescriptor.getInvalidConfigFailure()}}  - it returns {{null}} if the config has been successfully applied - otherwise it returns the failure.
Also changed the {{catch (Exception e)}} to {{catch (Throwable e)}} in the static initializer to catch really everything - even runtime exceptions.

This is not a good thing and I'm not sure whether to commit this one. [~benedict] ? 

> System.exit() calls should be removed from DatabaseDescriptor
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-7597
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7597
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 2.0.9 (earlier version should be affected as well)
>            Reporter: Pavel Sakun
>         Attachments: 7597.txt
>
>
> We're using SSTableSimpleUnsortedWriter API to generate SSTable to be loaded into cassandra. In case of any issue with config DatabaseDescriptor calls System.exit() which is apparently not the thing you expect while using API.
> Test case is simple:
> System.setProperty( "cassandra.config", "" );
> new YamlConfigurationLoader().loadConfig();
> Thread.sleep( 5000 );
> System.out.println("We're still alive"); // this will never be called



--
This message was sent by Atlassian JIRA
(v6.2#6252)