本文整理匯總了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());
}
示例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());
}
示例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());
}
示例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!");
}
示例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;
}
示例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.");
}
}
示例7: RequestLogRepository
import com.hazelcast.core.HazelcastInstance; //導入方法依賴的package包/類
@Autowired
public RequestLogRepository(HazelcastInstance hazelcastInstance) {
queue = hazelcastInstance.getQueue(CACHE_KEY);
}
示例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);
}
示例9: HazelcastQueueProducer
import com.hazelcast.core.HazelcastInstance; //導入方法依賴的package包/類
public HazelcastQueueProducer(HazelcastInstance hazelcastInstance, HazelcastDefaultEndpoint endpoint, String queueName) {
super(endpoint);
this.queue = hazelcastInstance.getQueue(queueName);
}