Skip to content

Instantly share code, notes, and snippets.

@andrewstevenson
Last active January 23, 2017 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewstevenson/5f015c6a91fd47068d29ec2fb5d4c397 to your computer and use it in GitHub Desktop.
Save andrewstevenson/5f015c6a91fd47068d29ec2fb5d4c397 to your computer and use it in GitHub Desktop.
import com.hazelcast.core.*;
import com.hazelcast.config.*;
import java.util.Map;
import java.util.Queue;
public class GettingStarted {
public static void main(String[] args) {
Config cfg = new Config();
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
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());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment