Package edu.brown.hstore.txns

Examples of edu.brown.hstore.txns.AbstractTransaction


                          request.getClass().getSimpleName(),
                          HStoreThreadManager.formatSiteName(site_id)));
        } // FOR
       
        // Added our own debug info
        AbstractTransaction ts = this.hstore_site.getTransaction(txn_id);
        if (ts != null) {
            responses.put(this.local_site_id, ts.debug());
        }

        // Then wait for all of our responses
        boolean success = false;
        try {
View Full Code Here


        // without needing to call checkQueueState()
       
        // Load one txn in the queue.
        Collection<AbstractTransaction> added = this.loadQueue(1);
        assertEquals(1, added.size());
        AbstractTransaction expected = CollectionUtil.first(added);
        assertNotNull(expected);
       
        BlockingTakeThread t = new BlockingTakeThread();
        t.start();
View Full Code Here

        assertTrue(t.isAlive());
       
        // Load one txn in the queue.
        // The thread will not be awoken because we have not moved time forward
        Collection<AbstractTransaction> added = this.loadQueue(1);
        AbstractTransaction expected = CollectionUtil.first(added);
        assertNull(t.result.get());
        assertEquals(1, added.size());
       
        // Now sleep and then update the time
        // The thread still won't be woken up
View Full Code Here

        int release = this.queue.getThrottleRelease();
        for (int i = 0, cnt = (max - release); i < cnt; i++) {
            ThreadUtil.sleep(TXN_DELAY);
//            EstTimeUpdater.update(System.currentTimeMillis());
            this.queueDbg.checkQueueState();
            AbstractTransaction ts = this.queue.poll();
            assertNotNull("i="+i, ts);
        } // FOR
        System.err.println(this.queue.debug());
        assertFalse(this.queue.toString(), this.queue.isThrottled());
    }
View Full Code Here

            String debug = String.format("i=%d", i);
           
            // Ok so what we're going to do here is peek into the
            // queue and make sure that that our expected txn
            // is the next one that's suppose to pop out
            AbstractTransaction to_remove = it.next();
            state = this.queueDbg.checkQueueState();
            assertEquals(debug, QueueState.UNBLOCKED, state);
            assertEquals(debug, to_remove, this.queue.peek());

            // Then we're going to delete it and make sure that the next txn
View Full Code Here

        // Now we should be able to remove the first of these mofos
        Iterator<AbstractTransaction> it = added.iterator();
        for (int i = 0; i < NUM_TXNS; i++) {
            ThreadUtil.sleep(TXN_DELAY);
//            EstTimeUpdater.update(System.currentTimeMillis());
            AbstractTransaction expected = it.next();
            assertNotNull(expected);
            if (i == 0) this.queueDbg.checkQueueState();
            assertEquals("i="+i, expected, this.queue.poll());
        } // FOR
    }
View Full Code Here

    public void testOutOfOrderRemoval() throws Exception {
        Collection<AbstractTransaction> added = this.loadQueue(NUM_TXNS);
        assertEquals(added.size(), this.queue.size());
       
        // Now grab the last one and pop it out
        AbstractTransaction last = CollectionUtil.last(added);
        assertTrue(this.queue.remove(last));
        assertFalse(this.queue.contains(last));
       
        // Now we should be able to remove the first of these mofos
        Iterator<AbstractTransaction> it = added.iterator();
View Full Code Here

       
        ThreadUtil.sleep(TXN_DELAY*2);
//        EstTimeUpdater.update(System.currentTimeMillis());
        // System.err.println(StringUtil.repeat("-", 100));
        this.queueDbg.checkQueueState();
        AbstractTransaction first = CollectionUtil.first(added);
        assertEquals(first, this.queue.peek());
        assertTrue(first.toString(), this.queue.remove(first));
        assertFalse(first.toString(), this.queue.contains(first));
       
        AbstractTransaction poll = this.queue.poll();
        assertNotSame(first, poll);
    }
View Full Code Here

       
        // Remove them one by one and make sure that the iterator
        // never returns an id that we removed
        Set<AbstractTransaction> removed = new HashSet<AbstractTransaction>();
        for (int i = 0, cnt = added.size(); i < cnt; i++) {
            AbstractTransaction next = added.get(i);
            assertFalse(next.toString(), removed.contains(next));
            assertTrue(next.toString(), this.queue.contains(next));
            assertTrue(next.toString(),this.queue.remove(next));
            removed.add(next);
           
            int it_ctr = 0;
            for (AbstractTransaction txn : this.queue) {
                assertNotNull(txn);
View Full Code Here

                this.queueDbg.checkQueueState();
                assertEquals(it.next(), this.queue.poll());
            }
            // The second time should be null
            else {
                AbstractTransaction ts = this.queue.poll();
                assertNull("Unexpected txn returned: " + ts, ts);
                break;
            }
        } // FOR
    }
View Full Code Here

TOP

Related Classes of edu.brown.hstore.txns.AbstractTransaction

Copyright © 2018 www.massapicom. 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.