@@ -113,50 +113,36 @@ public void accept(Integer integer) {
113113 while (rootCause .getCause () != null ) {
114114 rootCause = rootCause .getCause ();
115115 }
116- if (rootCause instanceof BindException ) {
117- int port = ConfigProviderResolver .instance ().getConfig ()
118- .getOptionalValue ("quarkus.http.port" , Integer .class ).orElse (8080 );
119- log .error ("Port " + port + " seems to be in use by another process. " +
120- "Quarkus may already be running or the port is used by another application." );
121- if (System .getProperty ("os.name" ).startsWith ("Windows" )) {
122- log .info ("Use 'netstat -a -b -n -o' to identify the process occupying the port." );
123- log .info ("You can try to kill it with 'taskkill /PID <pid>' or via the Task Manager." );
124- } else {
125- log .info ("Use 'netstat -anop | grep " + port + "' to identify the process occupying the port." );
126- log .info ("You can try to kill it with 'kill -9 <pid>'." );
127- }
128- deploymentProblem = rootCause ;
129- } else {
116+ if (!(rootCause instanceof BindException )) {
130117 deploymentProblem = t ;
131118 if (!augmentDone ) {
132119 log .error ("Failed to start quarkus" , t );
133120 }
134- }
135- if (!context .isAbortOnFailedStart ()) {
136- //we need to set this here, while we still have the correct TCCL
137- //this is so the config is still valid, and we can read HTTP config from application.properties
138- log .info ("Attempting to start hot replacement endpoint to recover from previous Quarkus startup failure" );
139- if (RuntimeUpdatesProcessor .INSTANCE != null ) {
140- Thread .currentThread ().setContextClassLoader (curatedApplication .getBaseRuntimeClassLoader ());
141-
142- try {
143- if (!InitialConfigurator .DELAYED_HANDLER .isActivated ()) {
144- Class <?> cl = Thread .currentThread ().getContextClassLoader ()
145- .loadClass (LoggingSetupRecorder .class .getName ());
146- cl .getMethod ("handleFailedStart" ).invoke (null );
121+ if (!context .isAbortOnFailedStart ()) {
122+ //we need to set this here, while we still have the correct TCCL
123+ //this is so the config is still valid, and we can read HTTP config from application.properties
124+ log .info (
125+ "Attempting to start hot replacement endpoint to recover from previous Quarkus startup failure" );
126+ if (RuntimeUpdatesProcessor .INSTANCE != null ) {
127+ Thread .currentThread ().setContextClassLoader (curatedApplication .getBaseRuntimeClassLoader ());
128+ try {
129+ if (!InitialConfigurator .DELAYED_HANDLER .isActivated ()) {
130+ Class <?> cl = Thread .currentThread ().getContextClassLoader ()
131+ .loadClass (LoggingSetupRecorder .class .getName ());
132+ cl .getMethod ("handleFailedStart" ).invoke (null );
133+ }
134+ RuntimeUpdatesProcessor .INSTANCE .startupFailed ();
135+ } catch (Exception e ) {
136+ close ();
137+ log .error ("Failed to recover after failed start" , e );
138+ //this is the end of the road, we just exit
139+ //generally we only hit this if something is already listening on the HTTP port
140+ //or the system config is so broken we can't start HTTP
141+ System .exit (1 );
147142 }
148- RuntimeUpdatesProcessor .INSTANCE .startupFailed ();
149- } catch (Exception e ) {
150- close ();
151- log .error ("Failed to recover after failed start" , e );
152- //this is the end of the road, we just exit
153- //generally we only hit this if something is already listening on the HTTP port
154- //or the system config is so broken we can't start HTTP
155- System .exit (1 );
156143 }
157144 }
158145 }
159-
160146 }
161147 } finally {
162148 Thread .currentThread ().setContextClassLoader (old );
0 commit comments