{"action":"created","issue":{"url":"https://api.github.com/repos/perwendel/spark/issues/388","repository_url":"https://api.github.com/repos/perwendel/spark","labels_url":"https://api.github.com/repos/perwendel/spark/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/perwendel/spark/issues/388/comments","events_url":"https://api.github.com/repos/perwendel/spark/issues/388/events","html_url":"https://github.com/perwendel/spark/issues/388","id":117156275,"number":388,"title":"Server shuts down when given port is in use","user":{"login":"Prototype1","id":9280361,"avatar_url":"https://avatars.githubusercontent.com/u/9280361?v=3","gravatar_id":"","url":"https://api.github.com/users/Prototype1","html_url":"https://github.com/Prototype1","followers_url":"https://api.github.com/users/Prototype1/followers","following_url":"https://api.github.com/users/Prototype1/following{/other_user}","gists_url":"https://api.github.com/users/Prototype1/gists{/gist_id}","starred_url":"https://api.github.com/users/Prototype1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Prototype1/subscriptions","organizations_url":"https://api.github.com/users/Prototype1/orgs","repos_url":"https://api.github.com/users/Prototype1/repos","events_url":"https://api.github.com/users/Prototype1/events{/privacy}","received_events_url":"https://api.github.com/users/Prototype1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/perwendel/spark/labels/Bug/Feature%20request","name":"Bug/Feature request","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-16T16:00:33Z","updated_at":"2016-04-12T09:38:48Z","closed_at":null,"body":"Hello, \r\n\r\nwe have a little problem with this code (JettySparkServer in method ignite()): \r\n\r\n} catch (Exception e) {\r\n            logger.error(\"ignite failed\", e);\r\n            System.exit(100); // NOSONAR\r\n}\r\n\r\nSystem.exit is actually pretty bad here. We have no chance in stopping the server from shutting down. \r\n\r\nIn our application we start a webserver and some other server. It is perfectly fine for us when the given port of the webserver is already in use but System.exit shuts down the whole jvm and thus our other server also.\r\n\r\nWould be nice when there was some workaround (like an exception handler which is configurable outside of spark)\r\n\r\nThanks in advance! \r\n\r\nCheers,   \r\n"},"comment":{"url":"https://api.github.com/repos/perwendel/spark/issues/comments/208817382","html_url":"https://github.com/perwendel/spark/issues/388#issuecomment-208817382","issue_url":"https://api.github.com/repos/perwendel/spark/issues/388","id":208817382,"user":{"login":"Prototype1","id":9280361,"avatar_url":"https://avatars.githubusercontent.com/u/9280361?v=3","gravatar_id":"","url":"https://api.github.com/users/Prototype1","html_url":"https://github.com/Prototype1","followers_url":"https://api.github.com/users/Prototype1/followers","following_url":"https://api.github.com/users/Prototype1/following{/other_user}","gists_url":"https://api.github.com/users/Prototype1/gists{/gist_id}","starred_url":"https://api.github.com/users/Prototype1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Prototype1/subscriptions","organizations_url":"https://api.github.com/users/Prototype1/orgs","repos_url":"https://api.github.com/users/Prototype1/repos","events_url":"https://api.github.com/users/Prototype1/events{/privacy}","received_events_url":"https://api.github.com/users/Prototype1/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T09:38:48Z","updated_at":"2016-04-12T09:38:48Z","body":"Hi, \r\n\r\nIts pretty easy to patch the class file to remove the problematic code.\r\nWhat I did: \r\nCopy the source code of the class JettySparkServer to a new File. Remove System.exit and compile it. Open Spark jar file and replace JettySparkServer class with your custom class.\r\n\r\nIt's an ugly workaround but works for us. The change was quite simply and didnt take me more than 15min.  \r\n  "}}