1919import java .util .LinkedHashMap ;
2020import java .util .Map ;
2121
22+ import org .apache .commons .logging .Log ;
23+ import org .apache .commons .logging .LogFactory ;
24+
2225import org .springframework .http .server .reactive .ContextPathCompositeHandler ;
2326import org .springframework .http .server .reactive .HttpHandler ;
2427import org .springframework .util .Assert ;
28+ import org .springframework .util .StopWatch ;
2529
2630/**
2731 * @author Rossen Stoyanchev
2832 */
2933public abstract class AbstractHttpServer implements HttpServer {
3034
35+ protected Log logger = LogFactory .getLog (getClass ().getName ());
36+
3137 private String host = "0.0.0.0" ;
3238
3339 private int port = 0 ;
@@ -116,9 +122,15 @@ public boolean isRunning() {
116122 public final void start () {
117123 synchronized (this .lifecycleMonitor ) {
118124 if (!isRunning ()) {
125+ String serverName = getClass ().getSimpleName ();
126+ logger .debug ("Starting " + serverName + "..." );
119127 this .running = true ;
120128 try {
129+ StopWatch stopWatch = new StopWatch ();
130+ stopWatch .start ();
121131 startInternal ();
132+ long millis = stopWatch .getTotalTimeMillis ();
133+ logger .debug ("Server started on port " + getPort () + "(" + millis + " millis)." );
122134 }
123135 catch (Throwable ex ) {
124136 throw new IllegalStateException (ex );
@@ -134,9 +146,14 @@ public final void start() {
134146 public final void stop () {
135147 synchronized (this .lifecycleMonitor ) {
136148 if (isRunning ()) {
149+ String serverName = getClass ().getSimpleName ();
150+ logger .debug ("Stopping " + serverName + "..." );
137151 this .running = false ;
138152 try {
153+ StopWatch stopWatch = new StopWatch ();
154+ stopWatch .start ();
139155 stopInternal ();
156+ logger .debug ("Server stopped (" + stopWatch .getTotalTimeMillis () + " millis)." );
140157 }
141158 catch (Throwable ex ) {
142159 throw new IllegalStateException (ex );
0 commit comments