Permalink
Browse files

refactoring in random client

  • Loading branch information...
1 parent d1a6926 commit 01b9d175e9931cb683ad3f6ae0b5fd63a4b19aa3 otaviojava committed Aug 29, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/main/java/org/easycassandra/persistence/PersistenceRandomClient.java
@@ -28,15 +28,17 @@
*/
public class PersistenceRandomClient extends Persistence{
+ private Random random;
PersistenceRandomClient(List<Client> clients, AtomicReference<ColumnFamilyIds> superColumnsRef,
String keySpace) {
super(superColumnsRef, keySpace);
this.clients=clients;
+ random=new Random();
}
private List<Client> clients;
@Override
public Client getClient() {
- Random random=new Random();
+
return clients.get(random.nextInt(clients.size()));
}

0 comments on commit 01b9d17

Please sign in to comment.