Skip to content

Instantly share code, notes, and snippets.

@khaosans
Created December 21, 2016 00:17
Show Gist options
  • Save khaosans/0de924ddaf2a0fed9e9d456017c59f4c to your computer and use it in GitHub Desktop.
Save khaosans/0de924ddaf2a0fed9e9d456017c59f4c to your computer and use it in GitHub Desktop.
Put into the hazelcast cache
public static void main(String[] args) throws InterruptedException {
ClientConfig clientConfig = new ClientConfig();
List<String> addressList = new ArrayList<String>();
addressList.add("localhost:5701");
clientConfig.getNetworkConfig().setAddresses(addressList).setConnectionAttemptLimit(1000);
HazelcastInstance hazelcasetInstance = HazelcastClient.newHazelcastClient(clientConfig);
for (int i = 0; i < 10000; i++) {
IMap<String, String> map = hazelcasetInstance.getMap("map");
System.out.println(i);
map.put(Integer.toString(i), "test");
Thread.sleep(1000);
}
hazelcasetInstance.shutdown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment