Search in sources :

Example 1 with Page

use of com.swiftmq.impl.store.standard.cache.Page in project swiftmq-ce by iitsoftware.

the class ReferenceMap method dump.

public synchronized void dump() {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/dump ...");
    for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry entry = (Map.Entry) iter.next();
        Integer rootPageNo = (Integer) entry.getKey();
        MessagePageReference ref = (MessagePageReference) entry.getValue();
        try {
            Page p = ctx.cacheManager.fetchAndPin(rootPageNo.intValue());
            MessagePage mp = new MessagePage(p);
            if (ctx.traceSpace.enabled)
                ctx.traceSpace.trace("sys$store", toString() + "/dump, rootPageNo=" + rootPageNo + ", ref=" + ref + ", mp=" + mp);
            ctx.cacheManager.unpin(rootPageNo.intValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/dump done");
}
Also used : Iterator(java.util.Iterator) Page(com.swiftmq.impl.store.standard.cache.Page) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with Page

use of com.swiftmq.impl.store.standard.cache.Page in project swiftmq-ce by iitsoftware.

the class PageOutputStream method flipPage.

private void flipPage() throws IOException {
    try {
        Page page = ctx.cacheManager.createAndPin();
        page.dirty = true;
        page.empty = false;
        if (rootPageNo == -1)
            rootPageNo = page.pageNo;
        pages.add(page);
        MessagePage mp = new MessagePage(page);
        if (actPage != null) {
            actPage.setNextPage(page.pageNo);
            mp.setPrevPage(actPage.page.pageNo);
            journal.add(new UpdatePortionLogAction(actPage.page.pageNo, 0, null, getPortion()));
        } else
            mp.setPrevPage(-1);
        mp.setNextPage(-1);
        actPage = mp;
        available = Page.PAGE_SIZE - MessagePage.START_DATA;
        pos = MessagePage.START_DATA;
        journal.add(new InsertLogAction(page.pageNo));
    } catch (Exception e) {
        e.printStackTrace();
        throw new IOException(e.toString());
    }
}
Also used : InsertLogAction(com.swiftmq.impl.store.standard.log.InsertLogAction) Page(com.swiftmq.impl.store.standard.cache.Page) IOException(java.io.IOException) UpdatePortionLogAction(com.swiftmq.impl.store.standard.log.UpdatePortionLogAction) IOException(java.io.IOException) UTFDataFormatException(java.io.UTFDataFormatException)

Example 3 with Page

use of com.swiftmq.impl.store.standard.cache.Page in project swiftmq-ce by iitsoftware.

the class UpdateLogAction method readContent.

/**
 * @param in
 * @throws IOException
 */
protected void readContent(DataInput in) throws IOException {
    beforeImage = new Page();
    beforeImage.read(in);
    afterImage = new Page();
    afterImage.read(in);
}
Also used : Page(com.swiftmq.impl.store.standard.cache.Page)

Aggregations

Page (com.swiftmq.impl.store.standard.cache.Page)3 InsertLogAction (com.swiftmq.impl.store.standard.log.InsertLogAction)1 UpdatePortionLogAction (com.swiftmq.impl.store.standard.log.UpdatePortionLogAction)1 IOException (java.io.IOException)1 UTFDataFormatException (java.io.UTFDataFormatException)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1