You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Heiko Braun <ik...@googlemail.com> on 2014/09/19 10:39:19 UTC

Use of System.exit() calls

Hi everybody,

I've been trying run Cassandra as a managed service from another java process and stumbled across the use of System.exit() calls in some of the core services (i.e DatabaseDescriptor, StorageService, SSTableReader). 

This makes the use as an embedded service very difficult and I can imagine that it easily creates other issues as well (i.e. freeing allocated resources).

Can somebody explain the rational behind using System.exit() calls opposed to the use of regular exceptions and handling the process shutdown in a well defined place (i.e the CassandraDaemon) ?

Regards, Heiko

Re: Use of System.exit() calls

Posted by Kasper Nielsen <ka...@gmail.com>.
Yeah it is rather annoying.

I install a "fake" security manager to get around this.
https://github.com/dma-ais/AisStore/blob/master/ais-store-raw/src/main/java/dk/dma/ais/store/old/exporter/CassandraNodeTool.java

Cheers
  Kasper


On Fri, Sep 19, 2014 at 10:39 AM, Heiko Braun <ik...@googlemail.com>
wrote:

>
> Hi everybody,
>
> I've been trying run Cassandra as a managed service from another java
> process and stumbled across the use of System.exit() calls in some of the
> core services (i.e DatabaseDescriptor, StorageService, SSTableReader).
>
> This makes the use as an embedded service very difficult and I can imagine
> that it easily creates other issues as well (i.e. freeing allocated
> resources).
>
> Can somebody explain the rational behind using System.exit() calls opposed
> to the use of regular exceptions and handling the process shutdown in a
> well defined place (i.e the CassandraDaemon) ?
>
> Regards, Heiko

Re: Use of System.exit() calls

Posted by Heiko Braun <ik...@googlemail.com>.
For the records, here's the Jira:

https://issues.apache.org/jira/browse/CASSANDRA-7997

On 19 Sep 2014, at 13:09, Heiko Braun <ik...@googlemail.com> wrote:

> 
> ok, good to know. that's what I had in mind. 
> 
> On 19 Sep 2014, at 12:27, Benedict Elliott Smith <be...@datastax.com> wrote:
> 
>> However in config (e.g. DatabaseDescriptor) it's just because we haven't
>> considered it worth our time to do anything more involved. Feel free to
>> file a ticket and post a patch.
> 


Re: Use of System.exit() calls

Posted by Heiko Braun <ik...@googlemail.com>.
ok, good to know. that's what I had in mind. 

On 19 Sep 2014, at 12:27, Benedict Elliott Smith <be...@datastax.com> wrote:

> However in config (e.g. DatabaseDescriptor) it's just because we haven't
> considered it worth our time to do anything more involved. Feel free to
> file a ticket and post a patch.


Re: Use of System.exit() calls

Posted by Benedict Elliott Smith <be...@datastax.com>.
There are some places we are unlikely to drop using System.exit(), such as
when we detect a dangerous application state (e.g. OOM)

However in config (e.g. DatabaseDescriptor) it's just because we haven't
considered it worth our time to do anything more involved. Feel free to
file a ticket and post a patch.

On Fri, Sep 19, 2014 at 9:39 AM, Heiko Braun <ik...@googlemail.com>
wrote:

>
> Hi everybody,
>
> I've been trying run Cassandra as a managed service from another java
> process and stumbled across the use of System.exit() calls in some of the
> core services (i.e DatabaseDescriptor, StorageService, SSTableReader).
>
> This makes the use as an embedded service very difficult and I can imagine
> that it easily creates other issues as well (i.e. freeing allocated
> resources).
>
> Can somebody explain the rational behind using System.exit() calls opposed
> to the use of regular exceptions and handling the process shutdown in a
> well defined place (i.e the CassandraDaemon) ?
>
> Regards, Heiko