Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89418957E for ; Tue, 1 May 2012 15:52:00 +0000 (UTC) Received: (qmail 32263 invoked by uid 500); 1 May 2012 15:52:00 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 32233 invoked by uid 500); 1 May 2012 15:52:00 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 32226 invoked by uid 99); 1 May 2012 15:52:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 May 2012 15:52:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 May 2012 15:51:57 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 746092388860; Tue, 1 May 2012 15:51:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1332711 - /sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java Date: Tue, 01 May 2012 15:51:36 -0000 To: commits@sling.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120501155136.746092388860@eris.apache.org> Author: fmeschbe Date: Tue May 1 15:51:36 2012 New Revision: 1332711 URL: http://svn.apache.org/viewvc?rev=1332711&view=rev Log: SLING-2461 Terminate Java VM if start or restart (after SystemBundle.update) failed and consolidate log messages Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java?rev=1332711&r1=1332710&r2=1332711&view=diff ============================================================================== --- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java (original) +++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java Tue May 1 15:51:36 2012 @@ -120,7 +120,10 @@ public class Main { } // finally start Sling - main.doStart(); + if (!main.doStart()) { + error("Failed to start Sling; terminating", null); + main.terminateVM(1); + } } /** @@ -335,7 +338,9 @@ public class Main { } }; } catch (IllegalArgumentException iae) { - startupFailure(iae.getMessage(), null); + error( + "Cannot launch: Launchpad folder cannot be used: " + + iae.getMessage(), null); return false; } this.loader = loaderTmp; @@ -389,7 +394,8 @@ public class Main { try { loader.installLauncherJar(launcherJar); } catch (IOException ioe) { - startupFailure("Failed installing " + launcherJar, ioe); + error("Cannot launch: Cannot install " + launcherJar + + " for use", ioe); return false; } } else { @@ -400,7 +406,7 @@ public class Main { try { object = loader.loadLauncher(SharedConstants.DEFAULT_SLING_MAIN); } catch (IllegalArgumentException iae) { - startupFailure("Failed loading Sling class " + error("Cannot launch: Failed loading Sling class " + SharedConstants.DEFAULT_SLING_MAIN, iae); return false; } @@ -422,7 +428,12 @@ public class Main { return true; } - error("There was a problem launching Apache Sling", null); + error("Cannot launch: Launcher.start() returned false", null); + + } else { + + error("Cannot launch: Class " + SharedConstants.DEFAULT_SLING_MAIN + " is not a Launcher class", null); + } return false; @@ -536,11 +547,6 @@ public class Main { return launchpadHome; } - private void startupFailure(String message, Throwable cause) { - error("Launcher JAR access failure: " + message, cause); - error("Shutting Down", null); - } - // ---------- logging // emit an informational message to standard out @@ -836,20 +842,28 @@ public class Main { if (updateFile == null) { Main.info("Restarting Framework and Apache Sling", null); - Main.this.startSling(null); + if (!Main.this.startSling(null)) { + Main.error("Failed to restart Sling; terminating", null); + Main.this.terminateVM(1); + } } else { Main.info( "Restarting Framework with update from " + updateFile, null); + boolean started = false; try { - Main.this.startSling(updateFile.toURI().toURL()); + started = Main.this.startSling(updateFile.toURI().toURL()); } catch (MalformedURLException mue) { Main.error("Cannot get URL for file " + updateFile, mue); } finally { updateFile.delete(); } + if (!started) { + Main.error("Failed to restart Sling; terminating", null); + Main.this.terminateVM(1); + } } } }