Examples of DistributedQueue


Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testOffer1() throws Exception {
        String dir = "/testOffer1";
        String testString = "Hello World";
        final int num_clients = 1;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        queueHandles[0].offer(testString.getBytes());

        byte dequeuedBytes[] = queueHandles[0].remove();
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testOffer2() throws Exception {
        String dir = "/testOffer2";
        String testString = "Hello World";
        final int num_clients = 2;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        queueHandles[0].offer(testString.getBytes());

        byte dequeuedBytes[] = queueHandles[1].remove();
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testTake1() throws Exception {
        String dir = "/testTake1";
        String testString = "Hello World";
        final int num_clients = 1;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        queueHandles[0].offer(testString.getBytes());

        byte dequeuedBytes[] = queueHandles[0].take();
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testRemove1() throws Exception{
        String dir = "/testRemove1";
        String testString = "Hello World";
        final int num_clients = 1;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        try{
            queueHandles[0].remove();
        }catch(NoSuchElementException e){
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void createNremoveMtest(String dir,int n,int m) throws Exception{
        String testString = "Hello World";
        final int num_clients = 2;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        for(int i=0; i< n; i++){
            String offerString = testString + i;
            queueHandles[0].offer(offerString.getBytes());
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void createNremoveMelementTest(String dir,int n,int m) throws Exception{
        String testString = "Hello World";
        final int num_clients = 2;
        ZooKeeper clients[] = new ZooKeeper[num_clients];
        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        for(int i=0; i< n; i++){
            String offerString = testString + i;
            queueHandles[0].offer(offerString.getBytes());
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testTakeWait1() throws Exception{
        String dir = "/testTakeWait1";
        final String testString = "Hello World";
        final int num_clients = 1;
        final ZooKeeper clients[] = new ZooKeeper[num_clients];
        final DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }

        final byte[] takeResult[] = new byte[1][];
        Thread takeThread = new Thread(){
            public void run(){
View Full Code Here

Examples of org.apache.zookeeper.recipes.queue.DistributedQueue

    public void testTakeWait2() throws Exception{
        String dir = "/testTakeWait2";
        final String testString = "Hello World";
        final int num_clients = 1;
        final ZooKeeper clients[] = new ZooKeeper[num_clients];
        final DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
        for(int i=0; i < clients.length; i++){
            clients[i] = createClient();
            queueHandles[i] = new DistributedQueue(clients[i], dir, null);
        }
        int num_attempts =2;
        for(int i=0; i< num_attempts; i++){
            final byte[] takeResult[] = new byte[1][];
            final String threadTestString = testString + i;
View Full Code Here

Examples of org.jgroups.blocks.DistributedQueue

    }

    public void start(String groupname, ChannelFactory factory, String props)
               throws ChannelException
    {
        h = new DistributedQueue(groupname, factory, props, 10000);
        h.addNotifier(this);

        setLayout(null);
        setSize(400, 300);
        setFont(default_font);
View Full Code Here

Examples of org.jgroups.blocks.DistributedQueue

    }

    public void start(String groupname, ChannelFactory factory, String props)
               throws ChannelException
    {
        h = new DistributedQueue(groupname, factory, props, 10000);
        h.addNotifier(this);

        setLayout(null);
        setSize(400, 300);
        setFont(default_font);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.