Of course it's better to never call System.exit() from an application server module. But, as I said in my last email the System.exit() is never called when running inside JBoss. But only from the command line version of the preprocessor - and there I think it is the normal way to do it to exit and return an error code from the command line application when something goes wrong. And this is the case for other System.exit usage in nuxeo sources - they are used only in command line or tests apps.
Never in application server modules.

Bogdan


Sergey Zhemzhitskiy wrote:
Are you think this is a normal situation, when I deploy my web application (based on nuxeo remote client) at runtime and then try to access it, the application server is terminated, if something goes wrong? If I have multiple applications which are deployed on the same application server they will be inaccessible too. I think it is better to throw an exception that indicates that something goes wrong.

I've done a search in the code and indeed there are several usage of System.exit but all are normal. These calls are used only in test apps or in client apps (command line) and not in the application server code.

Also the System.exit() call from the preprocessor is used only in the command line version of the preprocessor. If you look in the this call is inside a main() method which exists only to be able to run the preprocessing by hand from command line. You can see the same preprocessing code which is done from the ear deployer in
NuxeoDeployer.init(DeploymentInfo di)

       try {
           String url = di.localUrl.toString();
           url = url.replace(" ", "%20");
           File directory = new File(new URI(url));
           processor = new DeploymentPreprocessor(directory);
           // initialize
           processor.init();
           // and predeploy
           processor.predeploy();
           // let the EAR deployer doing its job
           super.init(di);
           ...
       } catch (URISyntaxException e) {
throw new DeploymentException("Failed to get deployment directory for " + di.shortName, e);
       } catch (Exception e) {
throw new DeploymentException("Deployment preprocessing failed for " + di.shortName, e);
       }


So no System.exit() is used when running preprocessing in jboss
So there is no real problem regarding  these calls.

For the deleOnExit methods I agree these should be avoided and we will remove them in near future.

Bogdan



Bogdan Stefanescu wrote:

Anyway this code will be removed from nuxeo ear deployer since the preprocessing step will be done as part of the build process (this code is already integrated as a maven plugin)

So we will no more have hot preprocessing in future since it is not compatible with other JEE AS servers.

Bogdan


Alain Escaffre wrote:
This method is called on the lowest layer of Nuxeo platform : if this one is not deployed correctly, the application mustn't start. So it makes sens to stop the process on error. We could argue that it is a problem for other running app, but usually in production, you isolate the applications in different jvm, so that they don't bother with each other.

Best regard,


Alain

Le 17 juil. 07 à 09:21, Filipchik Alexander a écrit :

When we had investigated your code we found that your developers uses System.exit(1) in several cases.

We found 11 usages of it. For example:

org.nuxeo.runtime.jboss.deployment.preprocessor.DeploymentPreprocessor

//line 412

         try {

            // initialize

            processor.init();

            // and predeploy

            processor.predeploy();

        } catch (Exception e) {

            e.printStackTrace();

            System.exit(1);

        }

And also you use deleteOnExit() when creating temp files. It can cause different faults.

System.exit – kills JBoss Server when executed

_______________________________________________
ECM mailing list
[email protected] <mailto:[email protected]>
http://lists.nuxeo.com/mailman/listinfo/ecm

------------------------------------------------------------------------

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm


_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm





_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to