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 class Main { | |
| public static void main(String[] args) { | |
| Config cfg = new XmlConfigBuilder().build(); | |
| HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(cfg); | |
| IMap<Object, Person> map = instance1.getMap("map"); | |
| Person p1 = new Person("mustafa", 25); | |
| p1.props.add("v1"); | |
| Person p2 = new Person("ahmet", 45); |
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
| /* | |
| * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| package com.hazelcast.monitor; | |
| public interface NearCacheStats extends LocalInstanceStats { | |
| /** | |
| * Returns the creation time of this NearCache on this member | |
| * | |
| * @return creation time of this NearCache on this member | |
| */ | |
| long getCreationTime(); |
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
| package com.hazelcast.cache; | |
| import com.hazelcast.monitor.NearCacheStats; | |
| public interface CacheStats { | |
| /** | |
| * Returns the total number of entries in the cluster | |
| * |
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 InterruptedException { | |
| Config cfg = new XmlConfigBuilder().build(); | |
| cfg.setProperty("hazelcast.local.localAddress", "127.0.0.1"); | |
| cfg.setProperty(GroupProperties.PROP_HEALTH_MONITORING_LEVEL, HealthMonitorLevel.NOISY.toString()); | |
| // memory stats will be logged in every 10 seconds | |
| cfg.setProperty(GroupProperties.PROP_HEALTH_MONITORING_DELAY_SECONDS, "10"); | |
| String cacheName = "cache"; | |
| MemorySize memorySize = new MemorySize(100, MemoryUnit.MEGABYTES); |
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
| private static class DefaultOutOfMemoryHandler extends OutOfMemoryHandler { | |
| public void onOutOfMemory(final OutOfMemoryError oom, final HazelcastInstance[] hazelcastInstances) { | |
| for (HazelcastInstance instance : hazelcastInstances) { | |
| if (instance != null) { | |
| Helper.tryCloseConnections(instance); | |
| Helper.tryStopThreads(instance); | |
| Helper.tryShutdown(instance); | |
| } | |
| } |
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
| HazelcastInstance instance = Hazelcast.newHazelcastInstance(); | |
| Hazelcast.setOutOfMemoryHandler(new OutOfMemoryHandler() { | |
| @Override | |
| public void onOutOfMemory(OutOfMemoryError oom, HazelcastInstance[] hazelcastInstances) { | |
| for (HazelcastInstance hazelcastInstance : hazelcastInstances) { | |
| hazelcastInstance.shutdown(); | |
| } | |
| System.err.println("danger!!!"); | |
| } | |
| }); |
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 class ClientContinuousQueryTest { | |
| public static void main(String[] args) { | |
| Config config = new Config(); | |
| HazelcastInstance instance = Hazelcast.newHazelcastInstance(config); | |
| IMap<Integer,Deal> theMap = instance.getMap("tradeMap"); | |
| theMap.put(3, new Deal(3)); | |
| ClientConfig clientConfig = new ClientConfig(); |
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
| package com.hazelmongo; | |
| import org.springframework.context.ApplicationContext; | |
| import org.springframework.context.support.GenericXmlApplicationContext; | |
| import java.util.Map; | |
| public class Main { |
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
| package com.hazelmongo; | |
| import java.io.Serializable; | |
| public class User implements Serializable { | |
| private String name; | |
| private int age; | |
| public User(String name, int age) { | |
| this.name = name; |