当前位置: 首页>>代码示例>>Java>>正文


Java HazelcastInstance.getMap方法代码示例

本文整理汇总了Java中com.hazelcast.core.HazelcastInstance.getMap方法的典型用法代码示例。如果您正苦于以下问题:Java HazelcastInstance.getMap方法的具体用法?Java HazelcastInstance.getMap怎么用?Java HazelcastInstance.getMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hazelcast.core.HazelcastInstance的用法示例。


在下文中一共展示了HazelcastInstance.getMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
    Config cfg = new Config();
    HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
    Map<Integer, String> mapCustomers = instance.getMap("customers");
    mapCustomers.put(1, "Joe");
    mapCustomers.put(2, "Ali");
    mapCustomers.put(3, "Avi");

    System.out.println("Customer with key 1: "+ mapCustomers.get(1));
    System.out.println("Map Size:" + mapCustomers.size());

    Queue<String> queueCustomers = instance.getQueue("customers");
    queueCustomers.offer("Tom");
    queueCustomers.offer("Mary");
    queueCustomers.offer("Jane");
    System.out.println("First customer: " + queueCustomers.poll());
    System.out.println("Second customer: "+ queueCustomers.peek());
    System.out.println("Queue size: " + queueCustomers.size());
}
 
开发者ID:datathings,项目名称:greycat,代码行数:20,代码来源:HazelcastScheduler.java

示例2: HazelcastTicketRegistry

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
/**
 * Instantiates a new Hazelcast ticket registry.
 *
 * @param hz                                   An instance of {@code HazelcastInstance}
 * @param mapName                              Name of map to use
 * @param ticketGrantingTicketTimeoutInSeconds TTL for TGT entries
 * @param serviceTicketTimeoutInSeconds        TTL for ST entries
 * @param pageSize                             the page size
 */
@Autowired
public HazelcastTicketRegistry(
    @Qualifier("hazelcast")
    final HazelcastInstance hz,
    @Value("${hz.mapname:tickets}")
    final String mapName,
    @Value("${tgt.maxTimeToLiveInSeconds:28800}")
    final long ticketGrantingTicketTimeoutInSeconds,
    @Value("${st.timeToKillInSeconds:10}")
    final long serviceTicketTimeoutInSeconds,
    @Value("${hz.page.size:500}")
    final int pageSize) {

    this.registry = hz.getMap(mapName);
    this.ticketGrantingTicketTimeoutInSeconds = ticketGrantingTicketTimeoutInSeconds;
    this.serviceTicketTimeoutInSeconds = serviceTicketTimeoutInSeconds;
    this.hz = hz;
    this.pageSize = pageSize;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:HazelcastTicketRegistry.java

示例3: HazelcastTicketRegistry

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
/**
 * @param hz                                  An instance of {@code HazelcastInstance}
 * @param mapName                             Name of map to use
 * @param ticketGrantingTicketTimeoutInSeconds TTL for TGT entries
 * @param serviceTicketTimeoutInSeconds       TTL for ST entries
 */
@Autowired
public HazelcastTicketRegistry(
    @Qualifier("hazelcast")
    final HazelcastInstance hz,
    @Value("${hz.mapname:tickets}")
    final String mapName,
    @Value("${tgt.maxTimeToLiveInSeconds:28800}")
    final long ticketGrantingTicketTimeoutInSeconds,
    @Value("${st.timeToKillInSeconds:10}")
    final long serviceTicketTimeoutInSeconds) {

    this.registry = hz.getMap(mapName);
    this.ticketGrantingTicketTimeoutInSeconds = ticketGrantingTicketTimeoutInSeconds;
    this.serviceTicketTimeoutInSeconds = serviceTicketTimeoutInSeconds;
    this.hz = hz;
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:23,代码来源:HazelcastTicketRegistry.java

示例4: executeSchemaChange

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
/**
 * Main method for executing the schema conversion to Hazelcast.
 * The method just needs to be called statically as it operates on files created during the initial
 * schema conversion process.
 */
public static void executeSchemaChange() {
    Config cfg = new Config();
    HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);

    mapNodes = instance.getMap("nodes");
    mapEdges = instance.getMap("edges");
    mapLabels = instance.getMap("labels");
    mapOut = instance.getMap("out");
    mapIn = instance.getMap("in");

    nodesMap();
    edgesMap();

    exampleQueries();
}
 
开发者ID:DTG-FRESCO,项目名称:cyp2sql,代码行数:21,代码来源:KeyValueTest.java

示例5: testGlobalCustomDelegateSerializationConfiguredProgrammaticallyForClientConfig

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Test
public void testGlobalCustomDelegateSerializationConfiguredProgrammaticallyForClientConfig() {
    Config memberConfig = new Config();
    SubZero.useAsGlobalSerializer(memberConfig);
    hazelcastFactory.newHazelcastInstance(memberConfig);

    String mapName = randomMapName();
    ClientConfig config = new ClientConfig();

    SubZero.useAsGlobalSerializer(config, MyGlobalDelegateSerlizationConfig.class);

    HazelcastInstance member = hazelcastFactory.newHazelcastClient(config);
    IMap<Integer, AnotherNonSerializableObject> myMap = member.getMap(mapName);
    myMap.put(0, new AnotherNonSerializableObject());
    AnotherNonSerializableObject fromCache = myMap.get(0);

    assertEquals("deserialized", fromCache.name);
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:19,代码来源:TestCustomerSerializers.java

示例6: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
	HazelcastInstance ins = Hazelcast.newHazelcastInstance();
	IMap<Integer, String> map = ins.getMap("");
	map.addEntryListener(new ListenerExample(), true);//添加自定义监听器
	map.put(1, "Grand Theft Auto");
	map.put(1, "Final Fantasy");
	map.put(2, "World Of Warcraft");
	
	HazelcastInstance insex = Hazelcast.newHazelcastInstance();
	IMap<Integer, String> mapex = insex.getMap("");
	
	System.out.println(mapex.get(1));
	System.out.println(mapex.get(2));
	mapex.remove(1);
	mapex.remove(2);
	System.exit(0);
}
 
开发者ID:chkui,项目名称:hazelcast-demo,代码行数:18,代码来源:ListenerDemo.java

示例7: hazelcastFileTrackerStorage

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Bean
public HazelcastFileTrackerStorage hazelcastFileTrackerStorage() {
	HazelcastInstance hazelcastInstance = beanFactory
			.getBean(HazelcastInstance.class);

	IMap<FileTrackingStatusKey, FileTrackingStatus> fileTrackerMemory = hazelcastInstance
			.getMap(DistributedMapNames.MAP.FILE_TRACKER_MAP.toString());

	IMap<String, AgentContact> agentSet = hazelcastInstance
			.getMap(DistributedMapNames.MAP.AGENT_NAMES.toString());

	IMap<String, LogTypeContact> logTypeSet = hazelcastInstance
			.getMap(DistributedMapNames.MAP.LOG_TYPES.toString());

	return new HazelcastFileTrackerStorage(fileTrackerMemory, logTypeSet,
			agentSet);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:18,代码来源:CoordinationDI.java

示例8: testAttributeInvalidate

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Test(timeout = 80000)
public void testAttributeInvalidate() throws Exception {

    CookieStore cookieStore = new BasicCookieStore();
    executeRequest("write", SERVER_PORT_1, cookieStore);

    String value = executeRequest("read", SERVER_PORT_1, cookieStore);
    assertEquals("value", value);

    value = executeRequest("invalidate", SERVER_PORT_1, cookieStore);
    assertEquals("true", value);

    HazelcastInstance instance = createHazelcastInstance();
    IMap<Object, Object> map = instance.getMap("default");
    assertEquals(0, map.size());
}
 
开发者ID:hazelcast,项目名称:hazelcast-jetty-sessionmanager,代码行数:17,代码来源:AbstractStickySessionsTest.java

示例9: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.addAddress("127.0.0.1:5701");
    HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
    IMap map = client.getMap("customers");
    System.out.println("Map Size:" + map.size());

    client.getDurableExecutorService("hello").submit(new HazelcastJob(() -> System.out.println("Hello")));

}
 
开发者ID:datathings,项目名称:greycat,代码行数:11,代码来源:HazelcastTest.java

示例10: HazelcastTicketRegistry

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
/**
 * @param hz An instance of <code>HazelcastInstance</code>
 * @param mapName Name of map to use
 * @param ticketGrantingTicketTimoutInSeconds TTL for TGT entries
 * @param serviceTicketTimeoutInSeconds TTL for ST entries
 */
public HazelcastTicketRegistry(final HazelcastInstance hz,
                               final String mapName,
                               final long ticketGrantingTicketTimoutInSeconds,
                               final long serviceTicketTimeoutInSeconds) {

    logInitialization(hz, mapName, ticketGrantingTicketTimoutInSeconds, serviceTicketTimeoutInSeconds);
    this.registry = hz.getMap(mapName);
    this.ticketGrantingTicketTimoutInSeconds = ticketGrantingTicketTimoutInSeconds;
    this.serviceTicketTimeoutInSeconds = serviceTicketTimeoutInSeconds;
    this.hz = hz;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:HazelcastTicketRegistry.java

示例11: fillModel

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
    HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(INSTANCE_NAME);
    if (instance != null) {
        IMap<String, byte[]> taskCache = instance.getMap(TASK_CACHE_NAME);
        LocalMapStats statistics = taskCache.getLocalMapStats();
        model.put("statistics", statistics);
    }
}
 
开发者ID:rodm,项目名称:teamcity-gradle-build-cache-plugin,代码行数:9,代码来源:BuildCachePage.java

示例12: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
	ClientConfig clientConfig = new ClientConfig();
	HazelcastInstance instance = HazelcastClient.newHazelcastClient(clientConfig);
	Map<Integer, String> clusterMap = instance.getMap("MyMap");
	Queue<String> clusterQueue = instance.getQueue("MyQueue");
	
	System.out.println("Map Value:" + clusterMap.get(1));
	System.out.println("Queue Size :" + clusterQueue.size());
	System.out.println("Queue Value 1:" + clusterQueue.poll());
	System.out.println("Queue Value 2:" + clusterQueue.poll());
	System.out.println("Queue Size :" + clusterQueue.size());
}
 
开发者ID:chkui,项目名称:hazelcast-demo,代码行数:13,代码来源:HazelcastGetStartClient.java

示例13: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
	//创建一个 hazelcastInstance实例
	HazelcastInstance instance = Hazelcast.newHazelcastInstance();
	Map<Integer, String> clusterMap = instance.getMap("MyMap");
	Queue<String> clusterQueue = instance.getQueue("MyQueue");
	
	System.out.println("Map Value:" + clusterMap.get(1));
	System.out.println("Queue Size :" + clusterQueue.size());
	System.out.println("Queue Value 1:" + clusterQueue.poll());
	System.out.println("Queue Value 2:" + clusterQueue.poll());
	System.out.println("Queue Size :" + clusterQueue.size());
}
 
开发者ID:chkui,项目名称:hazelcast-demo,代码行数:13,代码来源:HazelcastGetStartServerSlave.java

示例14: main

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建一个 hazelcastInstance实例
	HazelcastInstance instance = Hazelcast.newHazelcastInstance();
	// 创建集群Map
	Map<Integer, String> clusterMap = instance.getMap("MyMap");
	clusterMap.put(1, "Hello hazelcast map!");

	// 创建集群Queue
	Queue<String> clusterQueue = instance.getQueue("MyQueue");
	clusterQueue.offer("Hello hazelcast!");
	clusterQueue.offer("Hello hazelcast queue!");
}
 
开发者ID:chkui,项目名称:hazelcast-demo,代码行数:13,代码来源:HazelcastGetStartServerMaster.java

示例15: testGlobalCustomSerializerRegisteredInDefaultConfigFile

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Test
public void testGlobalCustomSerializerRegisteredInDefaultConfigFile() throws Exception {
    String mapName = randomMapName();
    Config config = new Config();
    SubZero.useAsGlobalSerializer(config);
    HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
    IMap<Integer, NonSerializableObjectRegisteredInDefaultConfigFile> myMap = member.getMap(mapName);

    myMap.put(0, new NonSerializableObjectRegisteredInDefaultConfigFile());
    NonSerializableObjectRegisteredInDefaultConfigFile fromCache = myMap.get(0);

    assertEquals("deserialized", fromCache.name);
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:14,代码来源:TestCustomerSerializers.java


注:本文中的com.hazelcast.core.HazelcastInstance.getMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。