Examples of InMemoryLinkedDataStore


Examples of net.timewalker.ffmq3.storage.data.impl.InMemoryLinkedDataStore

{
    private static final int MSG_COUNT = 1000;
   
    public void testStore() throws Exception
    {
        InMemoryLinkedDataStore store = new InMemoryLinkedDataStore("test",16,10000);
       
        assertEquals(0, store.size());
       
        int previous = -1;
        for (int n = 0 ; n < MSG_COUNT ; n++)
        {
            previous = store.store("test_"+n, previous);
            if (previous == -1)
                throw new IllegalStateException("No space left !");
        }
        assertEquals(MSG_COUNT, store.size());
        store.commitChanges();
       
        int count = 0;
        int current = store.first();
        while (current != -1)
        {
            /*Object data = */store.retrieve(current);
            //System.out.println(data);
            current = store.next(current);
            count++;
        }
        assertEquals(MSG_COUNT, count);
       
        // Delete half entries
        count = 0;
        current = store.first();
        while (current != -1)
        {
            int next = store.next(current);
            if (next != -1)
                next = store.next(next);
           
            store.delete(current);
            count++;
           
            current = next;
        }
        assertEquals(MSG_COUNT-count, store.size());
       
        int pos = -1;
        for(int n=0;n<count;n++)
        {
            previous = store.store("other_test_"+n, pos);
            if (previous == -1)
                throw new IllegalStateException("No space left !");
           
            pos = store.next(previous);
            if (pos != -1)
                pos = store.next(pos);
        }
        store.commitChanges();
        assertEquals(MSG_COUNT, store.size());
       
        //System.out.println(store);
       
        count = 0;
        current = store.first();
        while (current != -1)
        {
            /*Object data = */store.retrieve(current);
            //System.out.println(data);
            current = store.next(current);
            count++;
        }
        assertEquals(MSG_COUNT, count);
        store.close();
    }
View Full Code Here

Examples of net.timewalker.ffmq3.storage.data.impl.InMemoryLinkedDataStore

     * @see net.timewalker.ffmq3.storage.message.impl.AbstractMessageStore#createDataStore()
     */
    protected LinkedDataStore createDataStore()
    {
        int maxSize = queueDef.getMaxNonPersistentMessages();
        return new InMemoryLinkedDataStore(queueDef.getName()+" Volatile Store",
                                           Math.min(maxSize, 16),
                                           maxSize);
    }
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.