Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Prev Previous commit
Next Next commit
Append final keyword to unmodifiable variables
  • Loading branch information
donggyu04 committed Nov 5, 2020
commit b7fff69e4b5e2dbb8922084209a9fb37fbb0af4c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ public abstract class FileWatchdog extends Thread {
/**
* The name of the file to observe for changes.
*/
private String filename;
private final String filename;
private final File file;

/**
* The delay to observe between every check. By default set
* {@link #DEFAULT_DELAY}.
*/
private long delay = DEFAULT_DELAY;

private File file;
private long lastModified = 0;
private boolean warnedAlready = false;
private boolean interrupted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@

@Component
public class Config extends AbstractConfig implements ControllerConstants, ClusterConstants {
public static final String NONE_REGION = "NONE";
private static final String NGRINDER_DEFAULT_FOLDER = ".ngrinder";
private static final String NGRINDER_EX_FOLDER = ".ngrinder_ex";
private static final Logger LOG = LoggerFactory.getLogger(Config.class);

private final ListenerSupport<PropertyChangeListener> systemConfListeners = new ListenerSupport<>();

private Home home = null;
private Home exHome = null;
private PropertiesWrapper internalProperties;
Expand All @@ -78,11 +82,7 @@ public class Config extends AbstractConfig implements ControllerConstants, Clust
private String announcement = "";
private Date announcementDate;
private boolean verbose;


public static final String NONE_REGION = "NONE";
private boolean cluster;
private ListenerSupport<PropertyChangeListener> systemConfListeners = new ListenerSupport<>();

protected PropertiesKeyMapper internalPropertiesKeyMapper = PropertiesKeyMapper.create("internal-properties.map");
protected PropertiesKeyMapper databasePropertiesKeyMapper = PropertiesKeyMapper.create("database-properties.map");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class UserDefinedMessageSource extends AbstractMessageSource {
*/
static class LocaleAndCode {

private String locale;
private String code;
private final String locale;
private final String code;

public LocaleAndCode(String locale, String code) {
this.locale = locale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/
@SpringAware
public class AgentStateTask implements Callable<SystemDataModel>, Serializable {
private String ip;
private String name;
private final String ip;
private final String name;

public AgentStateTask(String ip, String name) {
this.ip = ip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@SpringAware
public class ConnectionAgentTask implements Callable<Void>, Serializable {

private String ip;
private int port;
private final String ip;
private final int port;

public ConnectionAgentTask(String ip, int port) {
this.ip = ip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.infra.schedule;

Expand Down Expand Up @@ -41,7 +41,7 @@ public class ScheduledTaskService implements IScheduledTaskService {

private final TransactionService transactionService;

private Map<Runnable, ScheduledFuture> scheduledRunnable = new ConcurrentHashMap<>();
private final Map<Runnable, ScheduledFuture> scheduledRunnable = new ConcurrentHashMap<>();

public void addFixedDelayedScheduledTask(Runnable runnable, int delay) {
final ScheduledFuture scheduledFuture = taskScheduler.scheduleWithFixedDelay(runnable, delay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public enum ContentType {
JSON("application/json", APPLICATION_JSON),
FORM_URL_ENCODED("application/x-www-form-urlencoded", APPLICATION_FORM_URLENCODED);

private String name;
private final String name;

private MediaType mediaType;
private final MediaType mediaType;

public static class ContentTypeDeserializer extends JsonDeserializer<ContentType> {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
public class NGrinderWebhookPlugin implements OnTestLifeCycleRunnable {

// Be injected manually for backward compatibility.
private WebhookService webhookService;
private final WebhookService webhookService;

private WebhookConfigService webhookConfigService;
private final WebhookConfigService webhookConfigService;

@Override
public void start(PerfTest perfTest, IPerfTestService perfTestService, String version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
@Getter
public class SamplingModel implements Serializable {
private String runningSample;
private String agentState;
private final String runningSample;
private final String agentState;

public SamplingModel(String runningSample, String agentState) {
this.runningSample = runningSample;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.perftest.service;

Expand All @@ -30,7 +30,7 @@
*/
public class ConsoleEntry {

private String ip;
private final String ip;
/**
* Console port number.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.perftest.service.monitor;

Expand Down Expand Up @@ -48,9 +48,9 @@ public class MonitorClientService implements Closeable, MonitorConstants {
}
}

private String ip;

private int port;
private final String ip;
private final int port;

private SystemInfo systemInfo = SystemInfo.NullSystemInfo.getNullSystemInfo();
private long lastAccessedTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@
*/
public class MonitorCollectorPlugin implements OnTestSamplingRunnable, Runnable, MonitorConstants {
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorCollectorPlugin.class);

private final Map<MonitorClientService, BufferedWriter> clientMap = new ConcurrentHashMap<>();
private final int port;
private Map<MonitorClientService, BufferedWriter> clientMap = new ConcurrentHashMap<>();
private final Long perfTestId;

private final IScheduledTaskService scheduledTaskService;
private final PerfTestService perfTestService;
private Long perfTestId;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.perftest.service.samplinglistener;

Expand All @@ -28,7 +28,7 @@
*/
public class PerfTestSamplingCollectorListener implements SamplingLifeCycleListener {
private final ScheduledTaskService scheduledTaskService;
private Runnable runnable;
private final Runnable runnable;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.region.model;

Expand All @@ -28,13 +28,16 @@
public class RegionInfo implements Serializable {

private static final long serialVersionUID = 1L;

private final Integer controllerPort;

private String regionName;

@Setter
private String ip;
private Integer controllerPort;

@Setter
private boolean visible = true;
private String regionName;


/**
* Constructor with true visibility.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class RegionService {

private final HazelcastInstance hazelcastInstance;

private Supplier<Map<String, RegionInfo>> allRegions = Suppliers.memoizeWithExpiration(new Supplier<Map<String, RegionInfo>>() {
private final Supplier<Map<String, RegionInfo>> allRegions = Suppliers.memoizeWithExpiration(new Supplier<Map<String, RegionInfo>>() {
@Override
public Map<String, RegionInfo> get() {
Map<String, RegionInfo> regions = Maps.newHashMap();
Expand All @@ -73,7 +73,7 @@ public Map<String, RegionInfo> get() {
}
}, REGION_CACHE_TIME_TO_LIVE_SECONDS, TimeUnit.SECONDS);

private Supplier<List<String>> allRegionNames = Suppliers.memoizeWithExpiration(new Supplier<List<String>>() {
private final Supplier<List<String>> allRegionNames = Suppliers.memoizeWithExpiration(new Supplier<List<String>>() {
@Override
public List<String> get() {
Set<Member> members = hazelcastInstance.getCluster().getMembers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void init() {
}
}

private Map<String, String> initParam = new HashMap<>();
private final Map<String, String> initParam = new HashMap<>();
private DAVConfig myDAVConfig;
private ServletContext servletContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Component
public class NullScriptHandler extends ScriptHandler {

private Map<FileType, String> codeMirrorKey = newHashMap();
private final Map<FileType, String> codeMirrorKey = newHashMap();

public NullScriptHandler() {
super("", "", null, null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.script.model;

Expand All @@ -18,19 +18,19 @@

/**
* File type of FileEntity.
*
*
* @since 3.0
*/
public enum FileType {
/** Python/Jython. */
PYTHON_SCRIPT("Jython Script", "py", FileCategory.SCRIPT, true, false),

/** Groovy Script. */
GROOVY_SCRIPT("Groovy Script", "groovy", FileCategory.SCRIPT, true, false),

/** Groovy Maven project. */
GROOVY_MAVEN_PROJECT("Groovy maven project", "pom", FileCategory.PROJECT, true, false),

/** Xml. */
XML("xml", "xml", FileCategory.DATA, true, true),
/** Text. */
Expand All @@ -57,7 +57,7 @@ public enum FileType {
/** Dir. */
DIR("dir", "", FileCategory.ETC, false, false);

private String description;
private final String description;
@Getter
private final FileCategory fileCategory;
private final String extension;
Expand All @@ -68,7 +68,7 @@ public enum FileType {

/**
* Constructor.
*
*
* @param description description of this file type
* @param extension file extension.
* @param fileCategory category of FileType.
Expand All @@ -86,7 +86,7 @@ public enum FileType {

/**
* Get file type by extension of given name.
*
*
* @param name name of file.
* @return FileType which matches to extension. UNKNOWN otherwise.
*/
Expand All @@ -96,7 +96,7 @@ public static FileType getFileTypeByName(String name) {

/**
* Get file type by extension.
*
*
* @param extension extension
* @return FileType which matches to extension. UNKNOWN otherwise.
*/
Expand All @@ -111,7 +111,7 @@ public static FileType getFileTypeByExtension(String extension) {

/**
* Get description of file type.
*
*
* @return file type description.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum GitHubConfigField {
NAME("name"), OWNER("owner"), REPO("repo"), ACCESS_TOKEN("access-token"),
BRANCH("branch"), BASE_URL("base-url"), REVISION("revision"), SCRIPT_ROOT("script-root");

private String value;
private final String value;

public static boolean isSupportedField(String fieldName) {
return stream(values()).anyMatch(field -> field.getValue().equals(fieldName));
Expand Down
Loading