Skip to content

Commit

Permalink
Avoid this escape.
Browse files Browse the repository at this point in the history
  • Loading branch information
baldersheim committed Aug 20, 2024
1 parent c550aac commit a2ce6ef
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @author Gunnar Gauslaa Bergem
* @author hmusum
*/
public final class JRTConnectionPool implements ConnectionPool {
public class JRTConnectionPool implements ConnectionPool {

private static final Logger log = Logger.getLogger(JRTConnectionPool.class.getName());

Expand Down Expand Up @@ -91,15 +91,15 @@ synchronized JRTConnection switchConnection() {
return currentConnection = newConnection;
}

public synchronized JRTConnection initialize() {
private synchronized JRTConnection initialize() {
return pickNewConnectionRandomly(getSources());
}

protected JRTConnection pickNewConnectionRandomly(List<JRTConnection> sources) {
final protected JRTConnection pickNewConnectionRandomly(List<JRTConnection> sources) {
return sources.get(ThreadLocalRandom.current().nextInt(0, sources.size()));
}

public List<JRTConnection> getSources() {
final public List<JRTConnection> getSources() {
List<JRTConnection> ret;
synchronized (connections) {
ret = new ArrayList<>(connections.values());
Expand Down

0 comments on commit a2ce6ef

Please sign in to comment.