Package org.apache.activemq.store.kahadb.disk.page

Examples of org.apache.activemq.store.kahadb.disk.page.Transaction.commit()


    @Override
    protected Index<String, Long> createIndex() throws Exception {

        Transaction tx = pf.tx();
        long id = tx.allocate().getPageId();
        tx.commit();

        HashIndex<String, Long> index = new HashIndex<String, Long>(pf, id);
        index.setKeyMarshaller(StringMarshaller.INSTANCE);
        index.setValueMarshaller(LongMarshaller.INSTANCE);
       
View Full Code Here


            try {
                i.unload(tx);
            } catch (Throwable ignore) {
            }
        }
        tx.commit();
    }

    abstract protected Index<String, Long> createIndex() throws Exception;

    synchronized private Index<String, Long> openIndex(String name) throws Exception {
View Full Code Here

        if (index == null) {
            index = createIndex();
            index.load(tx);
            indexes.put(name, index);
        }
        tx.commit();
        return index;
    }

    class Producer extends Thread {
        private final String name;
View Full Code Here

                while (!shutdown.get()) {
                    long c = counter;

                    String key = key(c);
                    index.put(tx, key, c);
                    tx.commit();
                    Thread.yield(); // This avoids consumer starvation..

                    onProduced(counter++);
                }
View Full Code Here

                    Long record = index.get(tx, key);
                    if (record != null) {
                        if( index.remove(tx, key) == null ) {
                            System.out.print("Remove failed...");
                        }
                        tx.commit();
                        onConsumed(counter++);
                    }
                }
            } catch (Throwable e) {
                e.printStackTrace();
View Full Code Here

    @Override
    protected Index<String, Long> createIndex() throws Exception {

        Transaction tx = pf.tx();
        long id = tx.allocate().getPageId();
        tx.commit();

        BTreeIndex<String, Long> index = new BTreeIndex<String, Long>(pf, id);
        index.setKeyMarshaller(StringMarshaller.INSTANCE);
        index.setValueMarshaller(LongMarshaller.INSTANCE);
       
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.