This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aws enabled="true"> | |
| <access-key>YOUR_ACCESS_KEY</access-key> | |
| <secret-key>YOUR_SECRET_KEY</secret-key> | |
| </aws> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| Map mymap = Hazelcast.getMap("mymap"); | |
| try { | |
| while (true) { | |
| for (int i = 0; i < 1000; i++) { | |
| mymap.put(System.currentTimeMillis(), new Byte[100000]); | |
| Thread.sleep(1); | |
| } | |
| System.out.println("Current Map Size:" + mymap.size()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Config cfg = new FileSystemXmlConfig("C:\\java\\hazelcast.xml"); | |
| Hazelcast.init(cfg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <map name="default"> | |
| <backup-count>1</backup-count> | |
| <time-to-live-seconds>0</time-to-live-seconds> | |
| <max-idle-seconds>0</max-idle-seconds> | |
| <eviction-policy>LRU</eviction-policy> | |
| <max-size policy="cluster_wide_map_size">3000</max-size> | |
| <eviction-percentage>25</eviction-percentage> | |
| <merge-policy>hz.ADD_NEW_ENTRY</merge-policy> | |
| </map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <map name="default"> | |
| <backup-count>1</backup-count> | |
| <time-to-live-seconds>10</time-to-live-seconds> | |
| <max-idle-seconds>0</max-idle-seconds> | |
| <eviction-policy>LRU</eviction-policy> | |
| <max-size policy="cluster_wide_map_size">0</max-size> | |
| <eviction-percentage>25</eviction-percentage> | |
| <merge-policy>hz.ADD_NEW_ENTRY</merge-policy> | |
| </map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) throws FileNotFoundException { | |
| try { | |
| Config cfg = new FileSystemXmlConfig("C:\\java\\hazelcast.xml"); | |
| Hazelcast.init(cfg); | |
| Map mymap = Hazelcast.getMap("mymap"); | |
| long start = System.currentTimeMillis(); | |
| while (true) { | |
| for (int i = 0; i < 1000; i++) { | |
| mymap.put(System.currentTimeMillis(), new Byte[100000]); | |
| Thread.sleep(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) throws FileNotFoundException { | |
| try { | |
| // Config cfg = new FileSystemXmlConfig("C:\\java\\hazelcast.xml"); | |
| // Hazelcast.init(cfg); | |
| IMap mymap = Hazelcast.getMap("mymap"); | |
| long start = System.currentTimeMillis(); | |
| while (true) { | |
| for (int i = 0; i < 1000; i++) { | |
| if (i % 2 == 0) | |
| mymap.put(System.currentTimeMillis(), new Byte[100000], 10, TimeUnit.SECONDS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def map = hazelService.map("customers") | |
| map.put("john", new Customer(name: "John", age: 27)) | |
| map["mike"] = new Customer(name: "Mike", age: 27) | |
| // try putting with timeout | |
| map.tryPut("alex", new Customer(name: "Alex", age: 23), 1, TimeUnit.SECONDS) | |
| // put object with TTL (time to live) | |
| map.put("mary", new Customer(name: "Mary", age: 45), 100, TimeUnit.SECONDS) | |
| println map.size() | |
| println map["mary"].age |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Customer implements Serializable { | |
| String name | |
| Integer age | |
| static constraints = { | |
| } | |
| String toString() { | |
| "name:${name}, age:${age}" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Server1Controller { | |
| def hazelService | |
| def index = { | |
| def cs = new Customer() | |
| cs.name = "tom" | |
| cs.age = 20 | |
| def customers = hazelService.queue("customers") | |
| customers << cs |