當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。