Simplify DefaultDeleteChangeMessage DefaultDeleteChangeMessage is just a wrapper around DeleteChangeMessage. Instead of extending RetryingRestModifyView and calling the applyImpl method from DeleteChangeMessage to bypass the retrying from DeleteChangeMessage, we can simply implement RestModifyView and delegate to the apply method of DeleteChangeMessage which takes care of the retrying. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I66a51173ee1b06c9cc2637b9c8e6583e90033f34
diff --git a/java/com/google/gerrit/server/restapi/change/DeleteChangeMessage.java b/java/com/google/gerrit/server/restapi/change/DeleteChangeMessage.java index 30cfad6..63f5bbe 100644 --- a/java/com/google/gerrit/server/restapi/change/DeleteChangeMessage.java +++ b/java/com/google/gerrit/server/restapi/change/DeleteChangeMessage.java
@@ -28,6 +28,7 @@ import com.google.gerrit.extensions.common.Input; import com.google.gerrit.extensions.restapi.Response; import com.google.gerrit.extensions.restapi.RestApiException; +import com.google.gerrit.extensions.restapi.RestModifyView; import com.google.gerrit.server.ChangeMessagesUtil; import com.google.gerrit.server.CurrentUser; import com.google.gerrit.server.account.AccountLoader; @@ -146,21 +147,18 @@ @Singleton public static class DefaultDeleteChangeMessage - extends RetryingRestModifyView<ChangeMessageResource, Input, ChangeMessageInfo> { + implements RestModifyView<ChangeMessageResource, Input> { private final DeleteChangeMessage deleteChangeMessage; @Inject - public DefaultDeleteChangeMessage( - DeleteChangeMessage deleteChangeMessage, RetryHelper retryHelper) { - super(retryHelper); + public DefaultDeleteChangeMessage(DeleteChangeMessage deleteChangeMessage) { this.deleteChangeMessage = deleteChangeMessage; } @Override - protected Response<ChangeMessageInfo> applyImpl( - BatchUpdate.Factory updateFactory, ChangeMessageResource resource, Input input) - throws Exception { - return deleteChangeMessage.applyImpl(updateFactory, resource, new DeleteChangeMessageInput()); + public Response<ChangeMessageInfo> apply(ChangeMessageResource resource, Input input) + throws RestApiException { + return deleteChangeMessage.apply(resource, new DeleteChangeMessageInput()); } } }