From: Michael Vorburger Date: Mon, 2 Jul 2018 19:19:45 +0000 (+0200) Subject: suppress warn log if replying 500 just for OptimisticLockFailedException X-Git-Tag: release/fluorine~2^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=3ffc73d4dfc132cfdf597a5bc3e7784855dbb854;p=neutron.git suppress warn log if replying 500 just for OptimisticLockFailedException Change-Id: Ia311b340e993f5210223f11616a7d1fac70c66ad Signed-off-by: Michael Vorburger --- diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java index 2ebd7960e..b03a2fa48 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java @@ -18,6 +18,8 @@ import java.net.HttpURLConnection; import java.util.List; import java.util.Objects; import javax.ws.rs.core.Response; +import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException; +import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.neutron.spi.INeutronCRUD; import org.opendaylight.neutron.spi.INeutronCRUD.Result; import org.opendaylight.neutron.spi.INeutronObject; @@ -101,7 +103,7 @@ public abstract class AbstractNeutronNorthbound, R e } else { return Response.status(HttpURLConnection.HTTP_OK).entity(newNeutronRequest(ans)).build(); } - } catch (OperationFailedException e) { + } catch (ReadFailedException e) { LOG.warn("get failed due to datastore problem; uuid: {}", uuid); throw new DatastoreOperationFailedWebApplicationException(e); } @@ -136,6 +138,9 @@ public abstract class AbstractNeutronNorthbound, R e } } return Response.status(HttpURLConnection.HTTP_CREATED).entity(input).build(); + } catch (OptimisticLockFailedException e) { + // Do not log this, it's "normal" - the driver will retry + throw new DatastoreOperationFailedWebApplicationException(e); } catch (OperationFailedException e) { LOG.warn("create failed due to datastore problem (possibly missing required fields); input: {}", input); throw new DatastoreOperationFailedWebApplicationException(e); @@ -186,6 +191,9 @@ public abstract class AbstractNeutronNorthbound, R e } T updated = neutronCRUD.get(uuid); return Response.status(HttpURLConnection.HTTP_OK).entity(newNeutronRequest(updated)).build(); + } catch (OptimisticLockFailedException e) { + // Do not log this, it's "normal" - the driver will retry + throw new DatastoreOperationFailedWebApplicationException(e); } catch (OperationFailedException e) { LOG.warn("update failed due to datastore problem (possibly missing required fields); input: {}", input); throw new DatastoreOperationFailedWebApplicationException(e); @@ -200,6 +208,9 @@ public abstract class AbstractNeutronNorthbound, R e } else { return Response.status(HttpURLConnection.HTTP_NO_CONTENT).build(); } + } catch (OptimisticLockFailedException e) { + // Do not log this, it's "normal" - the driver will retry + throw new DatastoreOperationFailedWebApplicationException(e); } catch (OperationFailedException e) { LOG.warn("delete failed due to datastore problem; uuid: {}", uuid); throw new DatastoreOperationFailedWebApplicationException(e);