Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Adding custom Suppress FindBugs class to make it JDK8 compatible (#502)
Browse files Browse the repository at this point in the history
Adding Getter for the CanUpdate and the CoolOffPeriodInMillis
  • Loading branch information
adityaj1107 authored Nov 2, 2020
1 parent cb82b4a commit 1151ae1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.amazon.opendistro.elasticsearch.performanceanalyzer.AppContext;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.store.rca.cluster.NodeKey;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.util.SuppressFBWarnings;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
Expand All @@ -27,7 +28,6 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.graalvm.compiler.options.SuppressFBWarnings;

public class CacheClearAction extends SuppressibleAction {
public static final String NAME = "CacheClear";
Expand Down Expand Up @@ -131,10 +131,8 @@ public static class Summary {
@SerializedName(value = IP)
private String[] ip;
@SerializedName(value = COOL_OFF_PERIOD)
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Used in Summary Serializing")
private long coolOffPeriodInMillis;
@SerializedName(value = CAN_UPDATE)
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Used in Summary Serializing")
private boolean canUpdate;

public Summary(final List<NodeKey> impactedNodes,
Expand All @@ -155,5 +153,13 @@ public String toJson() {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
return gson.toJson(this);
}

public boolean getCanUpdate() {
return this.canUpdate;
}

public long getCoolOffPeriodInMillis() {
return this.coolOffPeriodInMillis;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.amazon.opendistro.elasticsearch.performanceanalyzer.util;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.CLASS)
public @interface SuppressFBWarnings {
/**
* The set of FindBugs warnings that are to be suppressed in
* annotated element. The value can be a bug category, kind or pattern.
*
*/
String[] value() default {};

/**
* Optional documentation of the reason why the warning is suppressed
*/
String justification() default "";
}

0 comments on commit 1151ae1

Please sign in to comment.