Skip to content

Instantly share code, notes, and snippets.

@gurbuzali
Created February 20, 2014 12:25
Show Gist options
  • Save gurbuzali/9112383 to your computer and use it in GitHub Desktop.
Save gurbuzali/9112383 to your computer and use it in GitHub Desktop.
public class ClientProcess {
public static void main(String[] args) {
final ClientConfig clientConfig = new ClientConfig();
clientConfig.setConnectionPoolSize(Integer.valueOf(args[0]));
final HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
final IMap<Object,Object> map = client.getMap("map");
final Random random = new Random(System.currentTimeMillis());
final byte[] bytes = new byte[100];
int threadCount = Integer.valueOf(args[1]);
for (int i=0; i<threadCount; i++){
final Thread thread = new Thread(){
public void run() {
while (true) {
map.set(random.nextInt(1000), bytes);
}
}
};
thread.setDaemon(true);
thread.start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment