Resolves checkstyle errors for api-gateway, lazy-loading, leader-election (#1066)

* Reduces checkstyle errors in lazy-loading

* Reduces checkstyle errors in leader-election

* Reduces checkstyle errors in api-gateway
This commit is contained in:
Anurag Agarwal
2019-11-10 22:43:40 +05:30
committed by Ilkka Seppälä
parent 7f06f3b78c
commit eae09fc07e
30 changed files with 188 additions and 172 deletions

View File

@@ -38,7 +38,7 @@ public abstract class AbstractMessageManager implements MessageManager {
protected Map<Integer, Instance> instanceMap;
/**
* Construtor of AbstractMessageManager
* Construtor of AbstractMessageManager.
*/
public AbstractMessageManager(Map<Integer, Instance> instanceMap) {
this.instanceMap = instanceMap;
@@ -46,15 +46,16 @@ public abstract class AbstractMessageManager implements MessageManager {
/**
* Find the next instance with smallest ID.
*
* @return The next instance.
*/
protected Instance findNextInstance(int currentId) {
Instance result = null;
List<Integer> candidateList = instanceMap.keySet()
.stream()
.filter((i) -> i > currentId && instanceMap.get(i).isAlive())
.sorted()
.collect(Collectors.toList());
.stream()
.filter((i) -> i > currentId && instanceMap.get(i).isAlive())
.sorted()
.collect(Collectors.toList());
if (candidateList.isEmpty()) {
int index = instanceMap.keySet()
.stream()