Skip to content

Commit

Permalink
GEODE-7864: Prevent implicit narrowing. (apache#4870)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabarunnag authored Apr 17, 2020
1 parent bfbb398 commit b0bd165
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private void logServers() {
}
this.lastLogTime = now;

int queues = 0;
float queues = 0f;
int connections = 0;
for (ServerLoad l : loadMap.values()) {
queues += l.getSubscriptionConnectionLoad();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ public Set<PartitionMemberInfo> getPartitionedMemberDetails(String region) {
/**
* For testing only, calculate the total variance of the members
*/
public float getVarianceForTest() {
float variance = 0;
public double getVarianceForTest() {
double variance = 0;

for (Member member : this.members.values()) {
variance += variance(member.getTotalLoad(), member.getWeight(), getAverageLoad());
Expand All @@ -766,8 +766,8 @@ public float getVarianceForTest() {
/**
* For testing only, calculate the total variance of the members
*/
public float getPrimaryVarianceForTest() {
float variance = 0;
public double getPrimaryVarianceForTest() {
double variance = 0;

for (Member member : this.members.values()) {
variance += variance(member.getPrimaryLoad(), member.getWeight(), getPrimaryAverage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,8 @@ public void testRebalancingWithOfflineMembers() throws UnknownHostException {
}

private int doMoves(RebalanceDirector director, PartitionedRegionLoadModel model) {
float initialVariance = model.getVarianceForTest();
float initialPrimaryVariance = model.getPrimaryVarianceForTest();
double initialVariance = model.getVarianceForTest();
double initialPrimaryVariance = model.getPrimaryVarianceForTest();
if (DEBUG) {
System.out.println("Initial Model\n" + model + "\nVariance= " + initialVariance
+ ", Primary variance=" + initialPrimaryVariance + "\n---------------");
Expand All @@ -1509,8 +1509,8 @@ private int doMoves(RebalanceDirector director, PartitionedRegionLoadModel model
while (director.nextStep() && moveCount < MAX_MOVES) {

moveCount++;
float variance = model.getVarianceForTest();
float primaryVariance = model.getPrimaryVarianceForTest();
double variance = model.getVarianceForTest();
double primaryVariance = model.getPrimaryVarianceForTest();
if (DEBUG) {
System.out.println("---------------\nMove " + moveCount + "\n" + model + "\nVariance= "
+ variance + ", Primary variance=" + primaryVariance + "\n---------------");
Expand Down

0 comments on commit b0bd165

Please sign in to comment.