You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Nick Griffiths (JIRA)" <ji...@apache.org> on 2010/10/09 13:16:32 UTC

[jira] Created: (DAEMON-177) Allow fail during init

Allow fail during init
----------------------

                 Key: DAEMON-177
                 URL: https://issues.apache.org/jira/browse/DAEMON-177
             Project: Commons Daemon
          Issue Type: Improvement
    Affects Versions: 1.0.3
         Environment: linux
            Reporter: Nick Griffiths
            Priority: Minor
             Fix For: 1.0.4


It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.

At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921835#action_12921835 ] 

Nick Griffiths commented on DAEMON-177:
---------------------------------------

Ah, just did it, but cheers anyway.




> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception-v3.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Griffiths updated DAEMON-177:
----------------------------------

    Attachment: remove-fail-available-check.diff

removes the check for isAvailable in fail, to allow failing during init.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Griffiths updated DAEMON-177:
----------------------------------

    Attachment: allow-init-fail-via-init-exception.diff

Expands on previous patch to handle failing during init with an DaemonInitException.  this dumps the error message out using fail, and returns false from init to stop further start up.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DAEMON-177) Allow fail during init

Posted by "Mladen Turk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mladen Turk resolved DAEMON-177.
--------------------------------

    Resolution: Fixed

Applied to the trunk as r1023303.
Thanks for the patch!

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Griffiths updated DAEMON-177:
----------------------------------

    Attachment: allow-init-fail-via-init-exception-13.diff

get rid of reliance on Throwable#getCause 

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DAEMON-177) Allow fail during init

Posted by "Mladen Turk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919669#action_12919669 ] 

Mladen Turk commented on DAEMON-177:
------------------------------------

Daemon has JDK 1.3 as target. Throwable.getCause() is present in 1.4 onwards.


> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (DAEMON-177) Allow fail during init

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened DAEMON-177:
-------------------------


Re-opening because as mentioned on the dev list, the code does not compile under Java 1.3 because DaemonLoader calls InvocationTargetException.getCause().

Assuming that the above can be fixed, it would be useful to provide an example Daemon implementation that used DaemonInitException - or perhaps update one of the existing samples to throw it.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Griffiths updated DAEMON-177:
----------------------------------

    Attachment: simple-daemon-with-init-exception.diff

the diff of SimpleDaemon on top of r1023470 which shows an example of failing during initialisation.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception-v3.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff, simple-daemon-with-init-exception.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DAEMON-177) Allow fail during init

Posted by "Mladen Turk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921830#action_12921830 ] 

Mladen Turk commented on DAEMON-177:
------------------------------------

Can you make the patch for the current trunk?
I already committed the previous version, so the new patch would only need a diff for that getCause().

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception-v3.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DAEMON-177) Allow fail during init

Posted by "Nick Griffiths (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Griffiths updated DAEMON-177:
----------------------------------

    Attachment: allow-init-fail-via-init-exception-v3.diff

This time without getCause on InvocationTargetException (getTargetException instead) and modified SimpleDaemon example to use a DaemonInitException if it can't bind to its port.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception-v3.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DAEMON-177) Allow fail during init

Posted by "Mladen Turk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DAEMON-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mladen Turk resolved DAEMON-177.
--------------------------------

    Resolution: Fixed

Never mind. I modified the patch by hand. Thanks again.

> Allow fail during init
> ----------------------
>
>                 Key: DAEMON-177
>                 URL: https://issues.apache.org/jira/browse/DAEMON-177
>             Project: Commons Daemon
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: linux
>            Reporter: Nick Griffiths
>            Priority: Minor
>             Fix For: 1.0.4
>
>         Attachments: allow-init-fail-via-init-exception-13.diff, allow-init-fail-via-init-exception-v3.diff, allow-init-fail-via-init-exception.diff, remove-fail-available-check.diff
>
>
> It would be handy to be able to fail with a nice message during init, such as 'database not available' or 'no config file found' or whatever.
> At the moment, if you try that during init, you get an IllegalStateException.  I've attached a patch which removes this restriction in DaemonLoader, but failing at this stage doesn't stop the c code from calling start.  I could work around this in the DaemonLoader, but not sure that is the right approach.  I'll have a go at doing a patch for the c-code, but I'm not a confident in my c skills...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.