- protected Element handle(Document document, XmlElement operationElement, NetconfOperationRouter opRouter)
- throws NetconfDocumentedException {
- opRouter.close();
- return document.createElement(XmlNetconfConstants.OK);
+ protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement)
+ throws DocumentedException {
+ try {
+ sessionResources.close();
+ Preconditions.checkNotNull(session, "Session was not set").delayedClose();
+ LOG.info("Session {} closing", session.getSessionId());
+ } catch (Exception e) {
+ throw new DocumentedException("Unable to properly close session "
+ + getNetconfSessionIdForReporting(), DocumentedException.ErrorType.application,
+ DocumentedException.ErrorTag.operation_failed,
+ DocumentedException.ErrorSeverity.error, Collections.singletonMap(
+ DocumentedException.ErrorSeverity.error.toString(), e.getMessage()));
+ }
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());