19
19
import java .util .LinkedHashMap ;
20
20
import java .util .Map ;
21
21
22
+ import org .apache .commons .logging .Log ;
23
+ import org .apache .commons .logging .LogFactory ;
24
+
22
25
import org .springframework .http .server .reactive .ContextPathCompositeHandler ;
23
26
import org .springframework .http .server .reactive .HttpHandler ;
24
27
import org .springframework .util .Assert ;
28
+ import org .springframework .util .StopWatch ;
25
29
26
30
/**
27
31
* @author Rossen Stoyanchev
28
32
*/
29
33
public abstract class AbstractHttpServer implements HttpServer {
30
34
35
+ protected Log logger = LogFactory .getLog (getClass ().getName ());
36
+
31
37
private String host = "0.0.0.0" ;
32
38
33
39
private int port = 0 ;
@@ -116,9 +122,15 @@ public boolean isRunning() {
116
122
public final void start () {
117
123
synchronized (this .lifecycleMonitor ) {
118
124
if (!isRunning ()) {
125
+ String serverName = getClass ().getSimpleName ();
126
+ logger .debug ("Starting " + serverName + "..." );
119
127
this .running = true ;
120
128
try {
129
+ StopWatch stopWatch = new StopWatch ();
130
+ stopWatch .start ();
121
131
startInternal ();
132
+ long millis = stopWatch .getTotalTimeMillis ();
133
+ logger .debug ("Server started on port " + getPort () + "(" + millis + " millis)." );
122
134
}
123
135
catch (Throwable ex ) {
124
136
throw new IllegalStateException (ex );
@@ -134,9 +146,14 @@ public final void start() {
134
146
public final void stop () {
135
147
synchronized (this .lifecycleMonitor ) {
136
148
if (isRunning ()) {
149
+ String serverName = getClass ().getSimpleName ();
150
+ logger .debug ("Stopping " + serverName + "..." );
137
151
this .running = false ;
138
152
try {
153
+ StopWatch stopWatch = new StopWatch ();
154
+ stopWatch .start ();
139
155
stopInternal ();
156
+ logger .debug ("Server stopped (" + stopWatch .getTotalTimeMillis () + " millis)." );
140
157
}
141
158
catch (Throwable ex ) {
142
159
throw new IllegalStateException (ex );
0 commit comments