本文整理汇总了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);
}