Skip to content

Commit

Permalink
Fixed two NPEs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Dec 5, 2014
1 parent 3e1306c commit 9076b4a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ private class ClientPool {
public ClientPool() {
clients = new TransportClient[numConnectionsPerPeer];
locks = new Object[numConnectionsPerPeer];
for (int i = 0; i < numConnectionsPerPeer; i++) {
locks[i] = new Object();
}
}
}

Expand Down Expand Up @@ -120,7 +123,8 @@ public TransportClient createClient(String remoteHost, int remotePort) throws IO
// Create the ClientPool if we don't have it yet.
ClientPool clientPool = connectionPool.get(address);
if (clientPool == null) {
clientPool = connectionPool.putIfAbsent(address, new ClientPool());
connectionPool.putIfAbsent(address, new ClientPool());
clientPool = connectionPool.get(address);
}

int clientIndex = rand.nextInt(numConnectionsPerPeer);
Expand Down

0 comments on commit 9076b4a

Please sign in to comment.