Search in sources :

Example 1 with SessionRevertException

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));
    }
}
Also used : SessionConnectionLostException(org.openkilda.floodlight.error.SessionConnectionLostException) ImmutableSet(com.google.common.collect.ImmutableSet) Logger(org.slf4j.Logger) SessionCloseException(org.openkilda.floodlight.error.SessionCloseException) LoggerFactory(org.slf4j.LoggerFactory) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) MessageContext(org.openkilda.messaging.MessageContext) Set(java.util.Set) SessionErrorResponseException(org.openkilda.floodlight.error.SessionErrorResponseException) CompletableFuture(java.util.concurrent.CompletableFuture) IOFSwitch(net.floodlightcontroller.core.IOFSwitch) CorrelationContext(org.openkilda.floodlight.utils.CorrelationContext) Stream(java.util.stream.Stream) ImmutableList(com.google.common.collect.ImmutableList) SessionRevertException(org.openkilda.floodlight.error.SessionRevertException) Map(java.util.Map) SwitchWriteException(org.openkilda.floodlight.error.SwitchWriteException) OFMessage(org.projectfloodlight.openflow.protocol.OFMessage) Optional(java.util.Optional) OFErrorMsg(org.projectfloodlight.openflow.protocol.OFErrorMsg) OFType(org.projectfloodlight.openflow.protocol.OFType) OFBarrierRequest(org.projectfloodlight.openflow.protocol.OFBarrierRequest) SessionRevertException(org.openkilda.floodlight.error.SessionRevertException) OFBarrierRequest(org.projectfloodlight.openflow.protocol.OFBarrierRequest) SessionCloseException(org.openkilda.floodlight.error.SessionCloseException) SwitchWriteException(org.openkilda.floodlight.error.SwitchWriteException)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Stream (java.util.stream.Stream)1 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)1 SessionCloseException (org.openkilda.floodlight.error.SessionCloseException)1 SessionConnectionLostException (org.openkilda.floodlight.error.SessionConnectionLostException)1 SessionErrorResponseException (org.openkilda.floodlight.error.SessionErrorResponseException)1 SessionRevertException (org.openkilda.floodlight.error.SessionRevertException)1 SwitchWriteException (org.openkilda.floodlight.error.SwitchWriteException)1 CorrelationContext (org.openkilda.floodlight.utils.CorrelationContext)1 MessageContext (org.openkilda.messaging.MessageContext)1 OFBarrierRequest (org.projectfloodlight.openflow.protocol.OFBarrierRequest)1 OFErrorMsg (org.projectfloodlight.openflow.protocol.OFErrorMsg)1 OFMessage (org.projectfloodlight.openflow.protocol.OFMessage)1 OFType (org.projectfloodlight.openflow.protocol.OFType)1