Skip to content

Commit

Permalink
Merge 9fc0ba8 into 29e96ad
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinKirs committed Jul 23, 2019
2 parents 29e96ad + 9fc0ba8 commit 202d48f
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -23,7 +23,7 @@

import java.util.List;
import java.util.Properties;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
* Random slave database load-balance algorithm.
Expand All @@ -43,6 +43,6 @@ public String getType() {

@Override
public String getDataSource(final String name, final String masterDataSourceName, final List<String> slaveDataSourceNames) {
return slaveDataSourceNames.get(new Random().nextInt(slaveDataSourceNames.size()));
return slaveDataSourceNames.get(ThreadLocalRandom.current().nextInt(slaveDataSourceNames.size()));
}
}

0 comments on commit 202d48f

Please sign in to comment.