36
36
import org .slf4j .LoggerFactory ;
37
37
38
38
public class CommunityRestConf extends AbstractLightyModule {
39
-
40
39
private static final Logger LOG = LoggerFactory .getLogger (CommunityRestConf .class );
41
40
42
41
private final DOMDataBroker domDataBroker ;
@@ -47,12 +46,13 @@ public class CommunityRestConf extends AbstractLightyModule {
47
46
private final DOMSchemaService domSchemaService ;
48
47
private final InetAddress inetAddress ;
49
48
private final String restconfServletContextPath ;
49
+ private final WebContextSecurer webContextSecurer ;
50
50
private final int httpPort ;
51
51
private AbstractLightyWebServer jettyServer ;
52
52
private LightyJettyServerProvider lightyServerBuilder ;
53
53
private JaxRsEndpoint jaxRsEndpoint ;
54
- private WebContextSecurer webContextSecurer ;
55
54
private MdsalRestconfStreamRegistry mdsalRestconfStreamRegistry ;
55
+ private MdsalRestconfServer server ;
56
56
57
57
public CommunityRestConf (final DOMDataBroker domDataBroker , final DOMRpcService domRpcService ,
58
58
final DOMNotificationService domNotificationService ,
@@ -100,7 +100,7 @@ protected boolean initProcedure() throws ServletException {
100
100
}
101
101
102
102
final MdsalDatabindProvider databindProvider = new MdsalDatabindProvider (domSchemaService );
103
- final var server = new MdsalRestconfServer (databindProvider , domDataBroker , domRpcService ,
103
+ this . server = new MdsalRestconfServer (databindProvider , domDataBroker , domRpcService ,
104
104
domActionService , domMountPointService );
105
105
106
106
this .jettyServer = this .lightyServerBuilder .getServer ();
@@ -152,6 +152,15 @@ protected boolean stopProcedure() {
152
152
stopFailed = true ;
153
153
}
154
154
}
155
+ if (server != null ) {
156
+ try {
157
+ server .close ();
158
+ LOG .info ("MDSAL RESTCONF server stopped" );
159
+ } catch (final Exception e ) {
160
+ LOG .error ("{} failed to stop!" , this .server .getClass (), e );
161
+ stopFailed = true ;
162
+ }
163
+ }
155
164
if (this .lightyServerBuilder != null ) {
156
165
this .lightyServerBuilder = null ;
157
166
}
0 commit comments