Search in sources :

Example 1 with SwapAddress

use of com.swiftmq.impl.store.standard.swap.SwapAddress in project swiftmq-ce by iitsoftware.

the class NonPersistentStoreImpl method get.

public StoreEntry get(Object key) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/get, key=" + key);
    StoreEntry entry = null;
    try {
        SwapAddress sa = (SwapAddress) key;
        entry = sa.swapFile.get(sa.filePointer);
        entry.key = key;
    } catch (Exception e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/get done, key=" + key + ", entry=" + entry);
    return entry;
}
Also used : StoreEntry(com.swiftmq.swiftlet.store.StoreEntry) SwapAddress(com.swiftmq.impl.store.standard.swap.SwapAddress) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 2 with SwapAddress

use of com.swiftmq.impl.store.standard.swap.SwapAddress in project swiftmq-ce by iitsoftware.

the class NonPersistentStoreImpl method delete.

public void delete(Object key) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/delete, key=" + key);
    try {
        SwapAddress sa = (SwapAddress) key;
        sa.swapFile.remove(sa.filePointer);
        if (sa.swapFile.getNumberMessages() == 0) {
            sa.swapFile.close();
            swapFiles.remove(sa.swapFile);
            if (actSwapFile == sa.swapFile)
                actSwapFile = null;
        }
    } catch (Exception e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/delete done, key=" + key);
}
Also used : SwapAddress(com.swiftmq.impl.store.standard.swap.SwapAddress) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 3 with SwapAddress

use of com.swiftmq.impl.store.standard.swap.SwapAddress in project swiftmq-ce by iitsoftware.

the class NonPersistentStoreImpl method updateDeliveryCount.

public void updateDeliveryCount(Object key, int deliveryCount) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/updateDeliveryCount, key=" + key + ", deliveryCount=" + deliveryCount);
    try {
        SwapAddress sa = (SwapAddress) key;
        sa.swapFile.updateDeliveryCount(sa.filePointer, deliveryCount);
    } catch (Exception e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/updateDeliveryCount done, key=" + key + ", deliveryCount=" + deliveryCount);
}
Also used : SwapAddress(com.swiftmq.impl.store.standard.swap.SwapAddress) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 4 with SwapAddress

use of com.swiftmq.impl.store.standard.swap.SwapAddress in project swiftmq-ce by iitsoftware.

the class NonPersistentStoreImpl method insert.

public void insert(StoreEntry storeEntry) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/insert, storeEntry=" + storeEntry);
    try {
        checkSwapFile();
        SwapAddress sa = new SwapAddress();
        sa.swapFile = actSwapFile;
        sa.filePointer = sa.swapFile.add(storeEntry);
        storeEntry.key = sa;
    } catch (Exception e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/insert done, storeEntry=" + storeEntry);
}
Also used : SwapAddress(com.swiftmq.impl.store.standard.swap.SwapAddress) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Aggregations

SwapAddress (com.swiftmq.impl.store.standard.swap.SwapAddress)4 StoreException (com.swiftmq.swiftlet.store.StoreException)4 StoreEntry (com.swiftmq.swiftlet.store.StoreEntry)1