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


Java HazelcastInstance.getQueue方法代码示例

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


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

示例3: 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

示例4: 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

示例5: testHazelcast

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Bean
public Object testHazelcast(HazelcastInstance inst) throws Exception {

	ConcurrentMap aMap = inst.getMap("cz.rkr");
	aMap.put("initialValue1", "val1");
	aMap.put("initialValue2", "val2");
	aMap.put("initialValue3", "val3");
	aMap.put("initialValue4", "val4");
	aMap.put("initialValue5", "val5");

	IQueue<String> queueCustomers = inst.getQueue("cz.eetlite");
	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("Second customer: " + queueCustomers.peek());
	System.out.println("First customer: " + queueCustomers.poll());
	System.out.println("First customer: " + queueCustomers.poll());

	System.out.println("Queue size: " + queueCustomers.size());

	queueCustomers.put("TEST");
	System.out.println("Queue size: " + queueCustomers.size());
	System.out.println("take: " + queueCustomers.take());
	System.out.println("Queue size: " + queueCustomers.size());
	return aMap;
}
 
开发者ID:eetlite,项目名称:eet.osslite.cz,代码行数:29,代码来源:HazelcastConfiguration.java

示例6: HazelcastSedaEndpoint

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public HazelcastSedaEndpoint(final HazelcastInstance hazelcastInstance, final String uri, final HazelcastComponent component, final HazelcastSedaConfiguration configuration) {
    super(hazelcastInstance, uri, component);
    this.queue = hazelcastInstance.getQueue(configuration.getQueueName());
    this.configuration = configuration;
    if (ObjectHelper.isEmpty(configuration.getQueueName())) {
        throw new IllegalArgumentException("Queue name is missing.");
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:HazelcastSedaEndpoint.java

示例7: RequestLogRepository

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
@Autowired
public RequestLogRepository(HazelcastInstance hazelcastInstance) {
    queue = hazelcastInstance.getQueue(CACHE_KEY);
}
 
开发者ID:Mockenize,项目名称:mockenize-server,代码行数:5,代码来源:RequestLogRepository.java

示例8: HazelcastQueueConsumer

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public HazelcastQueueConsumer(HazelcastInstance hazelcastInstance, Endpoint endpoint, Processor processor, String cacheName) {
    super(hazelcastInstance, endpoint, processor, cacheName);

    IQueue<Object> queue = hazelcastInstance.getQueue(cacheName);
    queue.addItemListener(new CamelItemListener(this, cacheName), true);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:HazelcastQueueConsumer.java

示例9: HazelcastQueueProducer

import com.hazelcast.core.HazelcastInstance; //导入方法依赖的package包/类
public HazelcastQueueProducer(HazelcastInstance hazelcastInstance, HazelcastDefaultEndpoint endpoint, String queueName) {
    super(endpoint);
    this.queue = hazelcastInstance.getQueue(queueName);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:HazelcastQueueProducer.java


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