use of org.openkilda.floodlight.error.SessionRevertException in project open-kilda by telstra.
the class Session method close.
@Override
public void close() {
if (error) {
SessionRevertException e = new SessionRevertException(sw.getId());
incompleteRequestsStream().forEach(entry -> entry.completeExceptionally(e));
return;
}
if (closingBarrier != null) {
throw new IllegalStateException("Session already closed");
}
OFBarrierRequest barrier = sw.getOFFactory().barrierRequest();
closingBarrier = prepareRequest(barrier);
try {
actualWrite(barrier);
} catch (SwitchWriteException e) {
closingBarrier.completeExceptionally(e);
SessionCloseException closeError = new SessionCloseException(sw.getId());
incompleteRequestsStream().forEach(entry -> entry.completeExceptionally(closeError));
}
}
Aggregations